Jump to content

Uploading files with () chars


joquius

Recommended Posts

I have the following little quirk (upload script):

[code]
$file_name = basename ($_FILES['image']['name']);
$ul_dir = "/something_or_other/";
$ul_name = $ul_dir.$file_name;
move_uploaded_file ($_FILES['image']['tmp_name'], $ul_name);
getimagesize ($image_dir.$file_name); // $image_dir is defined elsewhere
[/code]

What happens is I get an error on the getimagesize() when the file name contains brackets or weird chars. Now I might turn out to be quite the dunce here, but is this to do with getimagesize or the request itself?

This is the error I get: "[<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request"

I don't usually get this error from getimagesize if the file doesn't exist.

Is this to do with the upload or the php function?
Link to comment
https://forums.phpfreaks.com/topic/29667-uploading-files-with-chars/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.