NetTalk Central

Author Topic: NT7 FileUpload Failed or Doesn't Finish  (Read 4557 times)

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
NT7 FileUpload Failed or Doesn't Finish
« on: March 04, 2013, 02:50:10 PM »
C6 NT7

Does anyone know of a way to determine how the different settings in NT7 impact the uploading of files -- other than by trial and error? 

For example, in NT6 I had to parse the filename manually, since the image was being stored in a different folder.  I checked the Remove WebFolderPath from Incoming Filename box.  Nothing seems to happen.  It is checked On in the demo, but the image name is still prepended with \uploads\  -- does this still need to be done manually?

In NT6, I saved the uploaded file into a non-NTWS folder so that it could be accessed via the desktop app.  I finally gave up (several hours) trying to get this to work in NT7, deleted the procedure and started from scratch.  Now I can't even get the picture uploaded (Fails in Chrome, doesn't finish in IE). No embedded code in the procedure or in the webhandler. 

What is now the preferred way to store photos in a non-NTWS folder?  Has that changed since NT6?

Thanks.

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: NT7 FileUpload Failed or Doesn't Finish
« Reply #1 on: March 04, 2013, 06:10:05 PM »
Making some progress.  Discovered that uploaded pix are going into the app folder vs. the \web\uploads\ folder. 

What would be causing that?

Thanks for any help with this.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT7 FileUpload Failed or Doesn't Finish
« Reply #2 on: March 04, 2013, 10:43:47 PM »
Hi Jim,

there were quite a few changes between NT6 and NT7 with regard to incoming files. the primary difference is the the "saving" of the incoming file has moved from the WebHandler (where you should remove your custom code) to the Form procedure itself (there's a Savefile::fieldname routine.)

If left unaltered it should be sent to the uploads folder, but I'm guessing you maybe have some code left in the webhandler Procedure?
or perhaps you are changing the uploadspath property?


cheers
Bruce


Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: NT7 FileUpload Failed or Doesn't Finish
« Reply #3 on: March 05, 2013, 04:53:02 AM »
Thanks Bruce.  I will revisit the code in the webhandler and other potential culprits.

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: NT7 FileUpload Failed or Doesn't Finish
« Reply #4 on: March 05, 2013, 09:05:46 AM »
Okay, finally fixed it by deleting my Webserver procedure and importing one from the demo.  That allows the file to upload properly.

Thanks for your help.

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: NT7 FileUpload Failed or Doesn't Finish
« Reply #5 on: March 05, 2013, 06:34:46 PM »
Hi Bruce: The upload is working fine.  Nice job!   I also like the MetroBlue style.  Very cool.

Two questions:

1. Where do I put my code to copy the uploaded file into my non-NTWS folder?  I had been doing this in the Validate embed.  I'm guessing that this should not be done in the webhandler.

2. I need to rename the Inv:Photo so that it is saved without the path prepended --> 'uploads/filename'.  When can I safely rename this?

Thank you,

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT7 FileUpload Failed or Doesn't Finish
« Reply #6 on: March 06, 2013, 01:24:31 AM »
>>2. I need to rename the Inv:Photo so that it is saved without the path prepended --> 'uploads/filename'.  When can I safely rename this?

you have a couple options here.
a) In WebHandler, ProcessLink method, before parent call, set

self.site.UploadsPath = 'c:\whatever'

This will make this the default location for all incoming file uploads.

b) In the Form, SaveFile::fieldname routine, before the line

p_web.SaveFile('MAI:MailBoxPicture',MAI:MailBoxPicture)

you can adjust the contents of MAI:MailBoxPicture
At this point MAI:MailBoxPicture holds the full file name, including path, of where the incoming file will be saved.

>> 1. Where do I put my code to copy the uploaded file into my non-NTWS folder?  I had been doing this in the Validate embed.  I'm guessing that this should not be done in the webhandler.

correct. In the form, in the SaveFile::FieldName routine, after the call to .SaveFile, the incoming file is now stored on disk (using the name passed as the second parater to .SendFile) and you can then do anything you like with it.

In the example I make a thumbnail from the incoming image there.

cheers
Bruce

Jim A

  • Full Member
  • ***
  • Posts: 203
    • View Profile
    • Email
Re: NT7 FileUpload Failed or Doesn't Finish
« Reply #7 on: March 06, 2013, 04:10:37 AM »
Thanks Bruce.