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.Quote:
Originally Posted by blue-eye-labs
Printable View
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.Quote:
Originally Posted by blue-eye-labs
How would I make it so it posts a URL to the image they uploaded?
You would need to make the success page dynamic and feed it the link through a query string.
Quote:
Originally Posted by bokeh
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?
By the way, this script rocks!
PHP Code:$src = "path/to/image.jpg"; //image location
list($w, $h) = getimagesize($src); //gets the image width/height
$minWidth = 800; //minimum image width
$minHeight = 600; //minimum image height
if($w >= $minWidth && $h >= $minHeight) {
do_stuff();
} else {
echo "Sorry, image does not meet resolution requirements.";
}
The image would have already had to be uploaded and then checked correct? I want to check while they are trying to upload it.
yeah it would have to be otherwise PHP can't work with it, it doesn't have to be stored though.
Thanks for this script - I have been struggling to get the uploading of images working properly for a long time!Quote:
Originally Posted by bokeh
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.
Thats awesome dude,
Thanks for clearing that up. :p
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"
thanks in advance
I've never done this before... However WordPress creates new folders depending on the month for uploads.
Sure it can be done.
Somehow :S
@knightman:
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 egThis will open the file "text_file.txt" in write mode.PHP Code:$file = fopen("text_file.txt", "w+");
You can then write to the file using fwrite():I hope that that helps.PHP Code:fwrite($file, "Hello!");
I had a post here, but found I had neglected to read the extra pages - seems I can't delete a post so I may as well explain why this is here.
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.