paulgc34 Posted July 4, 2006 Share Posted July 4, 2006 using this code for image uploads:<form action="" method="post" enctype="multipart/form-data"><input type="file" name="pictures[]"/><input type="file" name="pictures[]"/><input type="file" name="pictures[]"/><input type="submit" value="Send Photos >>"/></form><?phpforeach ($_FILES["pictures"]["error"] as $key => $error) {if ($error == UPLOAD_ERR_OK) {$tmp_name = $_FILES["pictures"]["tmp_name"][$key];$name = $_FILES["pictures"]["name"][$key];move_uploaded_file($tmp_name, "data/$name");}}?> How do I print a "successful" message to the browser when it's done uploading and is there a way to dispay a "UPLOADING" MESSAGE WHILE IT'S IN PROGRESS? Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/ Share on other sites More sharing options...
shocker-z Posted July 4, 2006 Share Posted July 4, 2006 <form action="" method="post" enctype="multipart/form-data"><input type="file" name="pictures[]"/><input type="file" name="pictures[]"/><input type="file" name="pictures[]"/><input type="submit" value="Send Photos >>"/></form><?phpforeach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "data/$name"); if (!is_file("data/$name") { $error='Image not uploaded'; } }}if (!$error) { echo("Successfully uploaded all images");} else { echo("ERROR Images have not all been uploaded");}?>No way to show uploading or a less you used javascript to popup a window that says uploading and then when window loaded u close the window by it's name..RegardsLiam Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-52984 Share on other sites More sharing options...
SharkBait Posted July 4, 2006 Share Posted July 4, 2006 After you have done all the move_uploaded_file() you could Header() to another page and show a 'Your upload was successful'As for showing a message saying 'Upload in Progress' I would look at using a javascript popup window or something.I havent really played with javascript much so I cant show any code, but the idea should get ya in the right direction.:) Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-52985 Share on other sites More sharing options...
paulgc34 Posted July 4, 2006 Author Share Posted July 4, 2006 How would I use the header() method. Can anyone show me what the code would be. I cant get the print messages method to work. Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-53013 Share on other sites More sharing options...
Birdman203 Posted July 4, 2006 Share Posted July 4, 2006 header('Location: url'); Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-53016 Share on other sites More sharing options...
paulgc34 Posted July 4, 2006 Author Share Posted July 4, 2006 I'm adding the:header("Location: http://www.escortlobby.com/");line to the code but it doesnt seem to be doing anything. Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-53021 Share on other sites More sharing options...
paulgc34 Posted July 4, 2006 Author Share Posted July 4, 2006 I'm getting this error:Warning: Cannot modify header information - headers already sent by (output started at /home/paulgc34/public_html/uploadphotos.php:6) in /home/paulgc34/public_html/uploadphotos.php on line 259 Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-53024 Share on other sites More sharing options...
paulgc34 Posted July 4, 2006 Author Share Posted July 4, 2006 heres the code:[color=red]<?php[/color]foreach ($_FILES["pictures"]["error"] as $key => $error) {if ($error == UPLOAD_ERR_OK) {$tmp_name = $_FILES["pictures"]["tmp_name"][$key];$name = $_FILES["pictures"]["name"][$key];move_uploaded_file($tmp_name, "data/$name");}}header("Location: http://www.escortlobby.com/");[color=red]?>[/color] Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-53026 Share on other sites More sharing options...
wildteen88 Posted July 4, 2006 Share Posted July 4, 2006 The cause is in uploadphotos.php on or around line 6. Could you post line 3 - 9 here so we can have look. Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-53030 Share on other sites More sharing options...
paulgc34 Posted July 4, 2006 Author Share Posted July 4, 2006 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title></head><body> Link to comment https://forums.phpfreaks.com/topic/13663-messages-displayed-to-browser-for-image-uploading/#findComment-53037 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.