peck Posted October 29, 2007 Share Posted October 29, 2007 I use the following form to upload and change the filename of 1 picture on my website : <form enctype="multipart/form-data" action="upload.php" method="POST"> < p>Pic 1</p> <input name="file1" type="file" id="file" size="50" /> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> <input type="submit" value="Upload" /> </form> and upload.php : <? $file_name = $HTTP_POST_FILES['file1']['name']; $random=rand(); $file_name2=$random.$file_name; $path= "imagens/".$file_name2; if($file1 !=none) { i f(copy($HTTP_POST_FILES['fis1']['tmp_name'], $path)) { echo "Uploaded"; } else { echo "Error"; } } ?> Now , is there any way i can tweak this script so i can upload multiple files with filename change? Also , let,s say that i upload 4 files at a time which are associated with an entry in the sql database.Each entry has an unique id with auto_increment attribute. Is there any way i can make the script create a different folder for each entry where to upload the picture files ? ( E.G. images/231/1.jpg , 2.jpg , 3.jpg , 4.jpg | images /232/1.jpg etc where 231 and 232 are the unique id's from the sql database ) Or do i have to name the files by the id and place them all in the same directory ( E.G. images/231-1.jpg , 231-2 ... 232-1.jpg and so on ). Quote Link to comment https://forums.phpfreaks.com/topic/75231-image-management-problem/ Share on other sites More sharing options...
zq29 Posted October 29, 2007 Share Posted October 29, 2007 mkdir() Quote Link to comment https://forums.phpfreaks.com/topic/75231-image-management-problem/#findComment-380500 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.