Announcement

Collapse
No announcement yet.

Frustration with File Uploads Form

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Frustration with File Uploads Form

    Hi all,

    I've just about had it up to my eyeballs with a file upload form application in scriptcase 8, and I'm looking for suggestions. Here's what I've got:

    I have a table, ss_files. It's pretty straight forward, but here's what the structure looks like:
    table_structure.jpg

    There seems to be two methods for file upload in scriptcase --
    1. Upload to Database using "Document (Database)" (Scriptcase seems to heavily prefer this method. I don't.)
    2. Upload to Directory on Server using "Document (File Name)" (My preference, but Scriptcase won't create the directories as specified)

    I've tried this using both methods.

    With method #1 I can get the file to upload to the database in the binary_data field, but I cannot figure out how to write an application to retrieve the file from the database afterward. This really does not break my heart, because the last thing I want is a bunch of file uploads bloating a table in my database and causing long-term havoc. Still, it's frustrating to see the file there in the field with the proper byte size and have no way to access it other than using a third party utility like phpMyAdmin. I need a way for employees to access these files.

    With method #2 I can get the file to upload to the /_lib/tmp folder, but Scriptcase modifies the file name to be something like sc#######_[Filename.ext]. It ignores my directive to create subfolders using the variables. It always puts the file in /_lib/tmp instead of moving the file to /vault/{customer_id}/{module_id}/{reference_id} as requested. It does not populate the "file_name" field in the database. It makes the entire table seem pointless for tracking what files have been uploaded and where they reside.

    Am I missing some key detail here? I've watched the video tutorial on this, which did not answer any questions for me. I've searched through the help documentation, which is similarly unhelpful. I've searched the forums but not found my exact problem, detailed above. I've tried it in a development environment and also deployed out to a QA environment with no major change. I was even hoping to look through the provided ScriptCase Ticketing system sample application for how they were managing file uploads, but it seems that when I upgraded to SC8, this ticketing sample app was broken and does not compile any longer.

    Any help would be appreciated!
    Last edited by anomaly0617; 01-19-2015, 04:01 PM.

  • #2
    at #2 scriptcase uploads the file into the default directory if you are not changing that. You can if you deploy in the advanced mode. there you can set the root upload directory. After that you can use the properties for subdirs etc.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Originally posted by aducom View Post
      at #2 scriptcase uploads the file into the default directory if you are not changing that. You can if you deploy in the advanced mode. there you can set the root upload directory. After that you can use the properties for subdirs etc.
      Albert,

      As usual your advice led me down the path that I needed to go down to solve this problem.

      Here's what I was missing:
      1. The fact that the file was appearing not only under /_lib/tmp with the sc#####_[filename.ext] but also in /_lib/file/doc as well. With the directory path specified as I had it, it actually appeared in /_lib/file/doc0/5/filename.ext . Once I found that I modified my directory path to say ./{customer_id}/{module_id}/{reference_id} so it would drop in /file/doc properly. I don't mind it appearing there instead of /vault... I just minded that the files did not seem to be going anywhere other than the tmp folder and with a random prefix that I could not create links to.

      2. The fact that the permissions on /_lib/file/doc needed to allow apache to write to them. As it turns out the folder this all drops in is owned by another user on the server, and this was messing with apache's ability to write the file into the folder. So I chown'ed /_lib/file/doc to be apache:[user] and that resolves apache's ability to write to the folder.

      Now in my grid view of all the uploaded files, I have a link to the uploaded file, and it works! Thanks for your help!

      Comment


      • #4
        Hello. I have a similar problem. I am uploading a csv file and everything works on development environment. When I move to production environment, The upload didnīt work. I made the changes Anomaly0617 made related to the _lib/tmp and _lib/files/doc directories. Now the upload works, but, when trying to populate a mysql table I get the following error: PDOStatement::execute(): LOAD DATA LOCAL INFILE forbidden. I have already modified the my.cnf file adding local-infile=1 for mysql and mysqld. As I said, on development environment it works, even using mysql console, it is related to some production environment configuration. Thanks in advance for any help.

        Comment


        • #5
          If you upload to a directory then be sure that you have sufficient rights. Depending on your hosting the owner of the directory could be 'apache' for instance causing trouble. If you store in the mysql database then the max. size of the file must be configured. I've never seen your error message however... There are loads of google results, but I couldn't find the cause. It for sure is a configuration issue within your php/mysql environment.
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment

          Working...
          X