I have wondered why you put the @ sign in front of a great many of your commands...
To suppress the PHP error message. If PHP were to output an error message it would make sending headers impossible and then the redirect on error wouldn't work.
That was just an example used in this script to ensure a unique file name.
in adition to this uploaded file with the unique file name, like "0123456789-image.jpg".. how can i set this or what aditional code do i need to also make a thumbnail with img filename like; "tn_0123456789-image.jpg" ?
I was wondering if there was a way to check to make sure the image uploaded is at least a certain resolution? Not sure how to check for that. Any suggestions?
You would need to make the success page dynamic and feed it the link through a query string.
Thanks for this script - I have been struggling to get the uploading of images working properly for a long time!
I am working on dynamic pages without a database. How do I implement a query string to the URL of my file with it's new name. This is going in my upload.success.php file & everything else in my other files is exactly as you have provided in your tutorial.
I realise that the initial part of the absolute url is added to the page itself so it's getting the new file name I'd like help with please.
when a user uploads either one or multiple pics.., is there a way to also create in a separated folder, a .txt file for each pic, (named with the same pic name) containing the ip of the uploader??
www is my root
/www/images/uploaded
(the uploaded images path)
/www/images/logs
(the path i want to store the .txt files)
so if i upload "someimage.jpg" the loaded pic filename is something like:
"1234567890-someimage.jpg"
i need those .txt files with the same name in the logs dir., ie:
"1234567890-someimage.jpg.txt"
so i can later display a msg displaying:
"uploaded by ip address xxx.xxx.xxx.xxx"
Yes, this is possible. I would suggest using a mysql database instead, but in order to read and write files you use file() operations.
Basically you use fopen("file", "mode") to open a file eg
PHP Code:
$file = fopen("text_file.txt", "w+");
This will open the file "text_file.txt" in write mode.
You can then write to the file using fwrite():
After some reading, and finding that my issues were, as i suspected, already addressed here...
I have to say thankyou for the excellent script. works beautifully.
I do however have some questions in regards to bypassing the unique file name feature.
Interested in using this code to update (overwrite) a single image manually. - eg: Journal page with an image I can update while in the field.
Bookmarks