Topic: Upload image then show image with success message. (Read 2734 times)
Chicken-run Manager
Posts: 9
58 credits Members referred : 0
« on: Nov 14, 2006, 09:51:32 PM »
Hi there, i'm very new to PHP and have now used the great easy upload script and files. Everything works great and i was wondering if it was possible to upload an image and if successful goto another web page and show the image on the new web page. This is currently working on http://www.canvasinc.co.uk/your_photos.php and i'm looking for the same functionality. If this is not possible with easy upload then please let me know. Thank you in advance.
-William-
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6277
38488 credits Members referred : 374
It's time to use PHP5!
« Reply #1 on: Nov 14, 2006, 10:33:57 PM »
check the example for this row:
Code:
<?php if ($my_upload->upload($new_name)) { // new name is an additional filename information, use this to rename the uploaded file // and add this row header("Location: the_page_with_image.php");
check also the PHP manual for the "header" function (your problem is not really upload related)
Chicken-run Manager
Posts: 9
58 credits Members referred : 0
« Reply #2 on: Nov 15, 2006, 12:10:21 AM »
Wow, thanks for the quick response. I have added the code and looked at the PHP manual for header info but i'm lost as what to do. The page now redirects to another but i need a code to be able to pull the uploaded image to be show on the new page. You can look at example http://www.canvasinc.co.uk/your_photos.php to see what i mean. Upload an image and the site redirects you to another page and shows the image that was uploaded.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6277
38488 credits Members referred : 374
It's time to use PHP5!
« Reply #3 on: Nov 15, 2006, 12:14:59 AM »
I'm confused...
on this redirected page it should be possible to show the image with an image tag
if you need the image name on the next page, then place him in the query string of the redirection url:
Chicken-run Manager
Posts: 9
58 credits Members referred : 0
« Reply #4 on: Nov 15, 2006, 12:22:56 AM »
when a customer uploads an image, i wouldn't know what the image name would be or what extension it is, so i would have thought using header("Location: yourpage.php?img=yourimage.jpg"); would be wrong. When you upload an image using easy upload, whan uploaded successfuly, the name of the image is shown on the page. All i would need is that code worked into header("Location: yourpage.php?img=yourimage.jpg");. Would this be possible?
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6277
38488 credits Members referred : 374
It's time to use PHP5!
« Reply #5 on: Nov 15, 2006, 12:42:06 AM »
yes on the next page you can use the var
$_GET['img'] in place of the image name.
of course your redirection variable need the var from the upload object:
Chicken-run Manager
Posts: 9
58 credits Members referred : 0
« Reply #6 on: Nov 15, 2006, 10:41:10 AM »
Again....thank you. I now have the image name being carried over to the next page in the browser address bar " .co.uk/upload2.php?img=1163579461.jpg" . I am now struggling to get the code that pulls the name "1163579461.jpg" and adds it to www.webaddress.co.uk/uploads/........ How do i do this? Once i crack this part i'll be over the moon!!!!.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6277
38488 credits Members referred : 374
Again....thank you. I now have the image name being carried over to the next page in the browser address bar " .co.uk/upload2.php?img=1163579461.jpg" . I am now struggling to get the code that pulls the name "1163579461.jpg" and adds it to www.webaddress.co.uk/uploads/........ How do i do this? Once i crack this part i'll be over the moon!!!!.
do you want to show the image or a page with the image?
Chicken-run Manager
Posts: 9
58 credits Members referred : 0
« Reply #8 on: Nov 15, 2006, 01:21:33 PM »
I'm looking to show a page with the image. Just as a though, is "<?php echo '<IMG SRC="/uploads/', $_GET['img'],'" WIDTH="500" HEIGHT="" BORDER="1" ALT="" />'; ?>" correct?
Chicken-run Manager
Posts: 9
58 credits Members referred : 0
« Reply #9 on: Nov 15, 2006, 01:34:58 PM »
Thank you so much for your help. I have it all working. I cannot thank you enough.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6277
38488 credits Members referred : 374
Chicken-run Manager
Posts: 9
58 credits Members referred : 0
« Reply #13 on: Nov 15, 2006, 04:20:16 PM »
Can you advise of a progress meter for easyupload or a program that would be simple to merge. As friends will be uploading images onto my server and will be 10mb each, i'll need a progress meter to let them know the upload in working.
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6277
38488 credits Members referred : 374
Global Moderator
Internet Junkie
Gender:
Posts: 1807
9006 credits Members referred : 6
« Reply #16 on: Nov 16, 2006, 12:34:12 AM »
Here is another one: progress bar but it's ASP based. The process doesn't sound too difficult: when submitting the upload form you will be able to read the file size in $_FILES['userfile']['size'] a process running in a new window or iframe can read the filesize of the temp file and with the two values you can figure out a 'percentage done' and display that on screen.
A quick fix could be to display an animated gif, stating the upload is currently processing...
« Last Edit: Nov 16, 2006, 12:36:12 AM by Mind_nl »
Chicken-run Manager
Posts: 9
58 credits Members referred : 0
« Reply #18 on: Nov 20, 2006, 12:17:33 AM »
Hi Olaf, I'm still unable to paypal your account, where can i find the info to do so? Please let me know as i do appreciate your contribution to the above. -William-
Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6277
38488 credits Members referred : 374
Hi Olaf, I'm still unable to paypal your account, where can i find the info to do so? Please let me know as i do appreciate your contribution to the above. -William-