How to upload big files to a folder in Scriptcase - Any type of file - say 50MB


I have successfully created applications that can upload filename, filesize, binary data file to a MySQL database. The bin file upload was of BLOB or LONGBLOB type.

The problem I have is that this method only allow filesizes of about 1Mb.

I need to upload in some cases files of about 50Mb to my applications.

I am not sure if there are settings on my side that is wrong, e.g. php.ini file ect. I will appreciate if someone can highlight all the check areas.

I do however think it will solve the problem if I can upload directly to a specifically allocated folder.

I will appreciated it if someone can point me in the correct directions with a step by step guideline on how to upload a big file to a folder and how to access it again in a view application.

I have raised the issue with ticket support, but the response is only refering back to the BLOB/LONGBLOB route.

Note: I am not a savvy programmer, I am working in the construction/mining industry.

Your problem most likely is on the MySQL side, which by default does not allow you to store larger files than 1mb. In the MySQL file (my.ini on windows afaik) you need to set

max_allowed_packet=50M or larger if you need that. You need to restart MySQL to make this change effective.

If you are not able to change that (your provider might need to help you) then you should consider storing these files not as a blob, but as a file.

Hi Albert,

Thanks for the response above.

The max_allowed_packet=50M worked temporarily.

I think the better way forward will be to safe the files in a specified folder under the root directory - not to have any data size limit errors.

Do you maybe have a tutorial on how to create the file upload input form to save the file to a folder, rather than in a LONGBLOB field in a table - in the Scriptcase environment?

And also a tutorial to create a viewing grid, showing a hyperlink to the file in the folder - that will download the file, once you click on the link?

I can send my scriptcase & mysql file (with no data), should you wish to have a look at it. Like I said it is working fine up to a point - e.g. If I upload some of our newsletters (approx. 5Mb size each) - I can upload about 20-30 and then it start with the loading errors - I am sure it must be a data limit error. Unfortunately, the files is too big too upload to this forum.

I am just unsure how to convert the LONGBLOB method (FileUpload, FileName, FileSize - fields) to a FILE UPLOAD TO A FOLDER method (also not sure if I need 3 fields now).

Another question is - Do I need to use the “procedure”-settings when creating a form (Insert, Update, Delete) in Scriptcase?

Your help will be much appreciated.

To save a file in a remote directory you simply need to change the field type to document/filename. The directory can be set upon deployment using the advanced option. Of course you can use any ftp client to upload documents but then you have to write some php to set the documentnames into the database. You can use some php directory fuctions for that. Besides the mysql limit (i think it’s a good idea to store documents separately, I hardly use the db to store files of sizes that big) you also have a php limit for uploading files. But this parameter can be set at the configuration page.

If you use the same fieldtype in your grid then the hyperlink will appear. In a form you have to set the field read only.

Hope this helps,

Thanks for your reply Albert.

I will give it a try.

I assume I only then need two fields - docfilename and docfilesize(only for info to enduser)

I will not make use of the ftp route to upload files.

I will rather use your scriptcase method above, with the hope that the scriptcase system will do the rest.

Thanks again for your time.

Hi Albert,

Just to let you know, that I think I made it worked.

Just one question, what will the PHP code be to allocated the filesize to the filesize field (int)?

I will put the code under the filesize events - onValidation?

Thanks again for your help.