NetTalk Central

Author Topic: file upload  (Read 6115 times)

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
file upload
« on: August 05, 2014, 08:16:36 PM »
I'm just starting with the file upload control, C9.1.11139, NT 7.39.  I'm finding nothing in the web uploads folder, although the control indicates a successful upload. 

My C9.1 environment is in a VM running Windows 7 pro.  I run the server in this same VM along with IE 11 to test the app, using 127.0.0.1:88.  I suspect a firewall issue but so far have not found the problem.  Any thoughts?

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: file upload
« Reply #1 on: August 05, 2014, 09:48:46 PM »
do you see the file arrive in the server log window as a POST?

Have you set the option on the form field to save the file when it arrives?
What other options on the File Upload tab for the field have you set or not set?

cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: file upload
« Reply #2 on: August 06, 2014, 10:41:48 AM »
Bruce,

     Thanks...that pointed me in the right direction.  Looking at the POST showed filename=''.  That is the filename variable was always blank.  I discovered that I had two versions of the target name field on my form.  One was a normal string, the other was the FileUpload control.  Having the "normal" string on the form caused the filename to be blank.

     Now that I have this working, I want to work on putting the uploaded file into a BLOB.  I have looked at your webinars 15, 20, 22 and 23, and will experiment with these techniques.  Then I will move to NT 8, which I see as of 8.13, you have added a feature to upload to a BLOB.
 
     In keeping with the BLOB feature for the FileUpload control, I would like to ask for another BLOB feature to be added in the next release.  When adding a Display control, we can go to the Image tab, and select an image name to display.  Could you add another item here to load an image from a select BLOB? 

Thanks,

Jeff

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: file upload
« Reply #3 on: August 06, 2014, 09:53:25 PM »
>> you have added a feature to upload to a BLOB.

hah - I'd forgotten about that... I had to go look to see if I did. :)

>> Could you add another item here to load an image from a select BLOB? 

I've added it to the list, but it's a non-trivial operation from the template point of view. That's because the image is embedded on the form (or page) simply as a name. We do not include the image itself at that point.

The browser gets that name, and makes a completely separate request for the image. And crucially, when it makes that request _all_ you get is the name.

The code to handle this needs to be in WebHandler - ie not in the Form itself. and the code in WebHandler needs to be "clever" enough to know _from just the name_ which table, and which blob field you want to serve out of.

Example 40 (File Download) has an example of serving (generically) from a blob table. but like I say, it would be non-trivial for the templates to generate that code and somehow "knowing" what it is you know about your tables and blobs.

Cheers
Bruce

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: file upload
« Reply #4 on: August 07, 2014, 12:31:47 AM »
Hmm, I may be asking for trouble here, but I don't think it'll be the best use of Bruce's time to add such features. We know where an uploaded file goes and we can do whatever we like to that file. If we want to stuff it into a blob, then fine. All that requires is a few lines of standard Clarion code that's no different from what we do in a desktop app. And likewise the other way, We know where the file resides and how it's stored so it's trivial to make it available for serving.

I'd much rather see Bruce spending his time on stuff that we can't easily do ourselves. For example the web client consuming a WSDL (nudge, nudge) and such  ;)

Just my 2 cents.
Peter

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: file upload
« Reply #5 on: August 07, 2014, 02:54:54 AM »
And a wink if necessary ;-)
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: file upload
« Reply #6 on: August 07, 2014, 07:38:47 AM »
Bruce,

     Thanks for considering adding the new feature.  Nothing urgent as I can use the manual method outlined in example 40.

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: file upload
« Reply #7 on: August 07, 2014, 11:45:26 AM »
Bruce,

     I updated to NT 8.23 so I could begin using the "upload to Blob feature" you added back in version 8.13.  My setup is shown in the three attached images.  I'm finding the Blob is not updated.  I have to add some code in the ValidateInsert or ValidateUpdate embed.  For example, I have ImageEx added so I use:  

                   ImageEx:FileToBlob(Ima:Image_Name, Ima:Image_Data)

Ima:Image_Data is the target Blob.

     I would have thought your new feature would handle this automatically.  Have I missed something here?

Thanks,

Jeff

[attachment deleted by admin]
« Last Edit: August 07, 2014, 11:49:14 AM by kingja »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: file upload
« Reply #8 on: August 11, 2014, 04:49:16 AM »
Hi Jeff,

I checked here in the example and it seems to be working automatically ok.
So perhaps the best way to resolve the problem in your app is if you make a small example.

Note that you have "save to disk" and "Save to blob" on - which is ok - but seems overkill. And you should remove the code you have added because that may break it.

Cheers
Bruce

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: file upload
« Reply #9 on: August 11, 2014, 06:44:53 AM »
Bruce,

     Thanks for the reply.  I have both set because I found it was not working automatically in my particular app.  I'll try again and if it still does not work, I'll send a sample app.

Thanks,

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Re: file upload
« Reply #10 on: August 11, 2014, 09:13:22 AM »
Bruce,

     I confirmed that the example #26 app does indeed work with blobs.  I had to add a new blob field to the mailbox file, however, as my version of the example did not have one.
     I tried duplicating all the settings in my app but still could not get it to upload to the target blob.  I have sent my app and dct to you by separate email.  Thanks for looking into this issue.

Jeff

kingja

  • Sr. Member
  • ****
  • Posts: 261
    • View Profile
    • Email
Solved - Re: file upload
« Reply #11 on: August 11, 2014, 11:45:58 AM »
Bruce,

     It seems the "Use Equate" field must be the same as the field name above it.  See the attached image.  Previously, I used "myFileUploadName" for the equate.  Now it works great, uploading directly to the Blob.

Thanks!

Jeff

[attachment deleted by admin]

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: file upload
« Reply #12 on: August 11, 2014, 09:40:10 PM »
Thanks Jeff - I'll look into it to make it better.

cheers
Bruce