0

I'm coding a web application and I need to be able to upload a CV. I have done my homework and tried everything I can find but I keep getting the same issue. In my PHP Script the $_FILES array is completely empty and the CV field is being sent to the $_POST array. My form big so I will just post the important code.

<form enctype="multipart/form-data" action="exec/register_user.php" method="post"> <input type="file" name="cv" id="cv"/> <input type='submit' value='Register' /> </form> 

Then I don't think it will help you with anything by posting the PHP code. But if i var_dump($GLOBALS), it shows that the $_FILES array is empty but 'cv' shows as a string in the $_POST array.

Any help will be appreciated. Thanks in advance!

2 Answers 2

2

This is normally caused by the uploaded file being too large and exceeding one of teh 2 defined upload limits. post_max_size or upload_max_filesize

You may be able to override these values in the .htaccess file if you have the right permissions to do so by adding teh following 2 lines.

php_value post_max_size 20M php_value upload_max_filesize 20M 

Would allow uploading of files upto 20 MB

Sign up to request clarification or add additional context in comments.

2 Comments

well the file that i was testing with is 138kb? would this normally be too big?
By default I think these values allow up to 2MB but that doesn't mean that your configuration uses the default values. With a file that small, I doubt this is the cause of your problem.
0

You are missing the hidden field max_file_size, required by PHP.

<!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="20000000" /> 

See the explanation here.

2 Comments

thanks, but i did actually see that somewhere and added it just before my file input but it didnt change anything?
All this will do is make it so the browser rejects a file that is too large rather than waiting for teh upload to complete and the server rejecting it. It is not required for php to accept a file.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.