简体   繁体   中英

PHP - move_uploaded_file doesn't work for music/video

I'm working on a upload script and using move_uploaded_file() function. The problem is, that it only works for .txt, .jpg, .psd and some other file types I've tryed, but not for .mp3, .mov, .avi and maybe others.

There is nothing to the script, it's just the function. An interesting thing is, that it doesn't show any error msgs, it just doesn't upload the file.

Does anybody have some experience with this problem?

Thanks, Mike.

I don't think this is actually down to file type , more to file size .

Create a PHP script that runs a <? phpinfo(); ?> <? phpinfo(); ?> <? phpinfo(); ?> and look out for the upload_max_filesize setting. It could be that it is something like 8 MB, causing all larger file uploads to fail.

If that is the case, you can try changing the setting using ini_set("upload_max_filesize", "3200000000"); for example. In most cases, if on a shared hosting package, that will probably not work, though. You may have to contact your hosting provider then.

You should also make your script throw reliable error messages. The attempt to upload a file that is too big usually shows up as an error when uploading the file. Check the Error Messages Explained chapter in the manual for the respective error codes and their meanings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM