Sami Posted May 13, 2010 Share Posted May 13, 2010 I have a problem using an file upload form on a iframe. Example: <?php echo $_files["file"]["type"]; ?> will be just empty, and I AM using enctype="multipart/form-data" .Do anybody know how I can fix it?URL: http://ripper.dontexist.com/beta.phpThe webpage is in Norwegian. Link to comment Share on other sites More sharing options...
jeffman Posted May 13, 2010 Share Posted May 13, 2010 PHP is case-sensitive. There is no $_files array. There is a $_FILES array. To debug that, try var_dump($_FILES) at the top of your script.Where is the script with the go() function? Link to comment Share on other sites More sharing options...
Sami Posted May 13, 2010 Author Share Posted May 13, 2010 I did replace the $_files whit upper case, but it didn't work, and the "var_dump" came up whit this: array(1) { ["file"]=> array(5) { ["name"]=> string(33) "Alice Deejay-Better off alone.mp3" ["type"]=> string(0) "" ["tmp_name"]=> string(0) "" ["error"]=> int(1) ["size"]=> int(0) }} And the go() function? I'm not using AJAX right now. Link to comment Share on other sites More sharing options...
chibineku Posted May 13, 2010 Share Posted May 13, 2010 Oh man, I haven't heard that song in freaking years. I'm not sure I miss it. Link to comment Share on other sites More sharing options...
jeffman Posted May 13, 2010 Share Posted May 13, 2010 For some reason, your file is not uploading completely.mp3 files can be big. If your upload exceeds the upload_max_filesize value set in your php.ini file, the file will not completely upload. You will get only a filename and no other data.If you execute the phpinfo() function (try this in a separate document) you will get a report that includes your current ini settings. Scroll down until you find upload_max_filesize. If it is smaller than the files you want to upload, you'll need to adjust the maximum in your php.ini file. If the server is not yours (if your site hosted) and you do not have such a file, try creating one in your root directory. That directory is probably the directory ABOVE your homepage directory. Simply add a line like this:upload_max_filesize = 20MOr whatever value seems correct for your application. Note that your host may not allow you to override this setting (or any ini settings). Different hosts have different rules. Sometimes if you email your host admins you can request this permission. Link to comment Share on other sites More sharing options...
jeffman Posted May 13, 2010 Share Posted May 13, 2010 MORE:These settings may also create problems:post_max_sizefile_uploads Link to comment Share on other sites More sharing options...
Sami Posted May 13, 2010 Author Share Posted May 13, 2010 In php.ini, I've found:✖ post_max_size = 8M✓ file_uploads = OnAnd "M" means MegaBytes? Than 1000 should be enough... Link to comment Share on other sites More sharing options...
Sami Posted May 13, 2010 Author Share Posted May 13, 2010 It didn't work. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 13, 2010 Share Posted May 13, 2010 According to your output in post 3, the error code is 1. If you look at this page:http://www.php.net/manual/en/features.file-upload.errors.phpthat says that an error code of 1 means that the file was larger than the upload_max_filesize directive in php.ini. It will help you in your PHP script to check the error code for each file that was uploaded and print out the associated error message. An error code of 0 means there was no error. Link to comment Share on other sites More sharing options...
Sami Posted May 14, 2010 Author Share Posted May 14, 2010 According to your output in post 3, the error code is 1. If you look at this page:http://www.php.net/manual/en/features.file-upload.errors.phpthat says that an error code of 1 means that the file was larger than the upload_max_filesize directive in php.ini. It will help you in your PHP script to check the error code for each file that was uploaded and print out the associated error message. An error code of 0 means there was no error.Yes, I forgot to restart Apache :)Thank you for your help, Deirdre's Dad and justsomeguy! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.