sahira shamsu
sahira shamsu

Reputation: 47

Can not upload certain files in PHP

I have an issue in image file upload when uploading certain files.

<form method="POST" action="upload.php" enctype="multipart/form-data">
    <input type="file" name="fileToUpload" id="fileupload">
    <input type="submit" name="fileSubmit" value="fileSubmit">
</form>

In my PHP file I tried to output the $_FILES["fileToUpload"] array but this was the result:

Array
(
    [name] => CIMG6223.JPG
    [type] => 
    [tmp_name] => 
    [error] => 1
    [size] => 0
)

$_FILES["fileToUpload"][tmp_name] was empty. I think some error occured in my uploading, but when I tried to upload another file, it could upload that file and there was value in $_FILES["fileToUpload"][tmp_name]. In my php.ini file, I changed post_max_size and upload_max_filesize to 100M, but I couldn't solve the issue.

Upvotes: 0

Views: 40

Answers (1)

Lawrence Cherone
Lawrence Cherone

Reputation: 46610

You should be checking for errors:

1 = UPLOAD_ERR_INI_SIZE Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

rtm: http://php.net/manual/en/features.file-upload.errors.php

Did you restart Apache?

Upvotes: 1

Related Questions