validkeys Posted February 20, 2007 Share Posted February 20, 2007 if I store pictures on my server as a number.ext. When the user downloads the picture, is it possible to rename the file when they download it (back to Alps.jpg from 2234241.jpg)? Thanks Quote Link to comment Share on other sites More sharing options...
corillo181 Posted February 20, 2007 Share Posted February 20, 2007 the same way you name it with number. use the same method for when the link is click you change the numbers to the name you wish. Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 20, 2007 Share Posted February 20, 2007 It depends on what you mean by download, and how you've stored the original name. Quote Link to comment Share on other sites More sharing options...
validkeys Posted February 20, 2007 Author Share Posted February 20, 2007 well the way it works is users upload their pictures to the site. I rename their picture to a number.ext and store it on my server. I keep the original filename in the database as well. As the users browse the site they can place pictures in a download basket. In their download basket, when they click download all, the download window will open and begin the download. When the pictures are on the user's computers I would like the files to have the original name that i had stored in the db Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 20, 2007 Share Posted February 20, 2007 Once they add them to the basket, copy the file on your server and rename it with the right name. Quote Link to comment Share on other sites More sharing options...
validkeys Posted February 20, 2007 Author Share Posted February 20, 2007 would I just copy it to a temp folder or something like that? thanks for the help by the way Quote Link to comment Share on other sites More sharing options...
Jessica Posted February 20, 2007 Share Posted February 20, 2007 Yeah that would work. Just make sure the folder gets cleaned up occasionally, but not too often so you don't interupt a download, you know. Quote Link to comment Share on other sites More sharing options...
hvle Posted February 20, 2007 Share Posted February 20, 2007 if directed user to download the file directly, then the renaming is all user control. however if you have a link like <a href="download.php?file=111">Click here to download file 111</a> you can recommend a download (save as) file name using header control: <?php header('Content-type: image/jpeg'); // The recommended save as file name, however, user can still change it header('Content-Disposition: attachment; filename="YourImage111.jpg"'); // The source image file on your server: readfile('111.jpg'); ?> Quote Link to comment Share on other sites More sharing options...
validkeys Posted February 21, 2007 Author Share Posted February 21, 2007 wow thanks a lot u guys! I owe you one Quote Link to comment 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.