This topic is locked
[SOLVED]

 conversion of image/file basic to newer multiple files field

9/3/2015 7:00:20 PM
PHPRunner General questions
C
chuckbower author

Has anyone written anything in MySQL that converts a field in a table from the old, basic image/file value to a new field that is in the format required for image/file with multiple files upload?
Ie. I have an older app (built in one of the V5 versions of PHPRunner) that stored the value of 1 uploaded file per field.

Now I am building the app in V8 and as part of a major file conversion, I want to take the MEDIUMTEXT field and convert the stored value into a format such that it looks like it was originally saved in the newer multiple upload files capability. As I want to use that in my newer app.
Even better, I have a situation where I had the older app with 3 fields, each storing an attachment. Now I want to be able to make that 1 field in the newer multiple upload files format, and hope there is a way to do this in MySQL, since I am already making other major changes to the file and running a script to convert the file (actually going to a new table, so using INSERT with SELECT FROM)
If you have something, and can share that would be great. If not, well, maybe I'll just do this the old fashioned manual way, and upload the files again for my tables (there's only about 120 rows across 3 different tables) HAHA.
Thanks in advance,

Chuck

Sergey Kornilov admin 9/4/2015

Unfortunately pure MySQL solution won't work here. This is needs to be a PHP script that goes through all records, gets file info and stores it in new format.

[{"name":"files\/0309prob_793d1viy.jpg","usrName":"0309prob.jpg","size":202433,"type":"image\/jpeg","searchStr":"0309prob.jpg,!:sStrEnd"}]


As you can see that there are some important bits of info like file size and file type that you can only figure out in PHP.