Pass a parameter to upload-many.php and rename
Pass a parameter to upload-many.php and rename
classic12
Posts: 228Questions: 60Answers: 4
Hi guys,
I have a database table that has a quoteID auto inc field.
I want to add a few images / files at a time but rename them as quoteID+-01.jpg quoteID+-02.jpg quoteID.xls
So I need to get the current quoteID ( Column 0 ) pass this then rename the files. 501-01.png 501-02.jpg 501-03.xls
I know how to read at parameter in PHP using $GET so
- Read the current quoteID
- How do I pass the parameter.
- Then do the renaming in the PHP file.
Cheers
Steve Warby
This discussion has been closed.
Answers
Hi Steve,
The issue there is that the field upload happens before the main row is created. So in this case when the files are uploaded there would be no quoteID as it doesn't exist yet! That's the reason why the examples don't show the host row id being used in the file name.
I'm assuming that the quote ID being in the file name that is downloaded is a system requirement - the only way I think that would work at the moment is to have the files named per the files ID table (like in the examples) and when the download request is made, proxy it through a PHP script that will download a file with the required name (i.e. look up the database to find what quote is using the file requested and get the quote id).
Regards,
Allan
Hi Allan,
I am using
So I have a global var selectedQuoteID. Can this be using in the editor before the choose file / drag file action ?
Cheers
Steve Warby
But my point is that you can't have that when you are creating a new row. The id for the new row isn't created until you submit the new form data to the server. By which time the files have already been uploaded.
Allan