garydt Posted July 22, 2007 Share Posted July 22, 2007 I've got- $uploadsDirectory = './uploads/'; //Upload image $uploadFilename = $uploadsDirectory.$a.$fieldname['name']; $a is a random generated number. Then the script calls a function to resize the image and saves it in the smallpics folder - if(imagejpeg($thumb, "smallpics/".$a.$name, 80)) { //image-resource, filename, quality return 1; } But it doesn't keep the generated number, it just saves it as the orignal file name. Why is this? Shall i post the full function script? Link to comment https://forums.phpfreaks.com/topic/61231-changing-uploaded-file-name/ Share on other sites More sharing options...
garydt Posted July 22, 2007 Author Share Posted July 22, 2007 Can anyone help? Link to comment https://forums.phpfreaks.com/topic/61231-changing-uploaded-file-name/#findComment-304761 Share on other sites More sharing options...
garydt Posted July 23, 2007 Author Share Posted July 23, 2007 I'm still having difficulties Link to comment https://forums.phpfreaks.com/topic/61231-changing-uploaded-file-name/#findComment-305268 Share on other sites More sharing options...
garydt Posted July 23, 2007 Author Share Posted July 23, 2007 can anyone help please? Link to comment https://forums.phpfreaks.com/topic/61231-changing-uploaded-file-name/#findComment-305525 Share on other sites More sharing options...
stlewis Posted July 24, 2007 Share Posted July 24, 2007 Why is it that you go to the trouble of creating a variable to hold your new file name, "$uploadFilename" but your IF statement tests (..smallpics/".$a.$name..) Shouldn't it be: if(imagejpeg($thumb, "$uploadFilename, 80)) { //image-resource, filename, quality return 1; } That might help a bit, sorry if it doesn't! Link to comment https://forums.phpfreaks.com/topic/61231-changing-uploaded-file-name/#findComment-305867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.