ievernova Posted April 22, 2009 Share Posted April 22, 2009 Hi, Is it possible to show the absolute UL of the image files uploaded after running this upload script? if so how? eg: http://mysite.com/admin/image1name.jpg http://mysite.com/admin/image2name.jpg http://mysite.com/admin/image3name.jpg ../admin/form.php: <form enctype="multipart/form-data" action="upload.php" method="post"> Image1: <input name="userfile[]" type="file" /><br /> Image2: <input name="userfile[]" type="file" /><br /> Image3: <input name="userfile[]" type="file" /><br /> Image4: <input name="userfile[]" type="file" /><br /> <input type="submit" value="Upload" /> </form> ../admin/Upload .php: <?php $success = 0; $fail = 0; $uploaddir = ''; for ($i=0;$i<4;$i++) { if($_FILES['userfile']['name'][$i]) { $uploadfile = $uploaddir . basename($_FILES['userfile']['name'][$i]); $ext = strtolower(substr($uploadfile,strlen($uploadfile)-3,3)); if (preg_match("/(jpg|gif|png|bmp)/",$ext)) { if (move_uploaded_file($_FILES['userfile']['tmp_name'][$i], $uploadfile)) { $success++; } else { echo "Error Uploading the file. Retry after sometime.\n"; $fail++; } } else { $fail++; } } } echo "<br> Number of files Uploaded:".$success; echo "<br> Number of files Failed:".$fail; ?> THANKS ALOT!!!!!!!! Link to comment https://forums.phpfreaks.com/topic/155139-upload-multiple-imags-then-echo-absolute-url/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.