I think Sniper's right. a lot of the tutorials on the web are a bit pants IMO, and are only good if you actually understand the code in the first place[Sniper][Wolf] said:If the web was full of decent tutorials


I think Sniper's right. a lot of the tutorials on the web are a bit pants IMO, and are only good if you actually understand the code in the first place[Sniper][Wolf] said:If the web was full of decent tutorials
[Sniper][Wolf] said:It doesnt do anything, when i click submit i just get a blank page and nothing its uploaded/outputted
isset said:All of the code posted in this thread is relying on the browser to send the correct mime type of the uploaded file (image/jpeg/pjpeg). You should not trust this information as it is all too easily faked.
marc2003 said:at first i thought this might be because i only tested on a non-apache windows server.but i've just tested on a ubuntu/apache box and it works fine. so the problem is with you i'm afraid.....
edit: i've posted a more functional script here
[Sniper][Wolf] said:I did get it working in the end, well the file types anyway, i just need to work on the rest of the switch case method including the rest of the restrictions, to test that its worked iv just echo'ed $message at the end and check the file has been uploaded.
marc2003 said:take a look at the link you just quoted. i posted the full version of the script i did. does the whole thumbnail creation, more image types, displays all the uploaded images, allows you to delete etc....
marc2003 said:interesting. what's the worse case scenario for someone spoofing the mime type? i'm genuinely curious as i've only recently started messing about with php.
btw the code i linked to in my previous post is using php's imagecreatefrom..... functions so if the script is unable to create a valid image resource, the file doesn't get uploaded. hopefully that should be safe enough?![]()
isset said:As a side note, you'll probably want to strip out '.'s when you generate the target file path. You could alter where your script attempted to write files to quite easily (move_uploaded_file($tmp_path, '/some/directory/my../../uploaded/file.jpg')... oops)