|
|
Rank: Newbie
Groups: Registered
Joined: 3/25/2008 Posts: 5
|
Hi,
I'm very much a .net novice so any help would be appreciated...using uploadManager (and the UploadManagerVB sample project), after a successful upload I would like to automatically send an SMTP email containing a link to the uploaded file. I've added an additional field (name="email") to enter an email address in the uploadForm form within UploadHandler.aspx. I'm trying to get hold of this input in the uploadManager_UploadComplete sub using uploadForm.email.value but can't ('upLoad form not declared')! Can anybody tell me where I'm going wrong - I suspect I'm way off the mark! - or suggest a better solution?
Thanks
Sam
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
To access custom fields in the UploadHandler.aspx, you'll need to handle the upload from within that file instead of using the UploadComplete event -- the UploadedFile array is the only part of the request that's merged into the parent page request. To do this, add the following code to the Page_Load event of the UploadHandler.aspx file:
Dim status As UploadStatus = HttpUploadModule.GetUploadStatus()
If Not status Is Nothing Then ' TODO: put code from UploadComplete event here End If
You'll also need to add the following namespace imports to the top of the codebehind:
Imports Krystalware.SlickUpload Imports Krystalware.SlickUpload.Status
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/25/2008 Posts: 5
|
Thanks Chris. I've added your code and inserted the contents of the UploadComplete event where suggested. Should I also need to copy any code ( UploadManager?) from UploadArea.ascx into the UploadHandler page? If not, how can I declare uploadPanel, uploadResultsPanel etc. now in the UploadHandler ?
Thanks again
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
You can leave any code that manipulates the page (e.g. showing/hiding uploadPanel/uploadResultsPanel) in the UploadComplete event. That will continue to run so you can update the page display. Put just the code that needs to access other form values on the UploadHandler page.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/25/2008 Posts: 5
|
If you don't mind, can I ask one final (I hope) question on this..? I've added RequiredFieldValidators to my TextBox's and really need them to be populated before a user is able to select a file and upload it. However, validation doesn't seem to be working... I'm using
< asp:Button ID="submitButton" runat="Server" Text="Send It" class="suSubmitButton" OnClientClick="SlickUpload_Submit();return false;" />
in the UploadArea.ascx with
AutoUploadOnPostBack="false"
in the UploadManager. I'm also finding (in IE6 and Firefox 2.0) the UploadManagerRequiredFieldValidator isn't prohibiting the submitbutton from firing if no file is selected...
Thanks for any help you can offer
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
Calling SlickUpload_Submit() directly submits the files. It assumes you have validated the form and does not trigger validation. To check validation first, call the ASP.NET client validation function before calling SlickUpload_Submit(). To do this, replace your OnClientClick statement with the following:
OnClientClick="if (Page_ClientValidate()) { SlickUpload_Submit(); } return false;"
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/25/2008 Posts: 5
|
Including the Page_ClientValidate() function still doesn't seem to validate the other inputs I have in the uploadHandler on the page - I'm still struggling with this! Is there anything else I can try?
|
|
|
Rank: Administration

Groups:
Joined: 7/7/2005 Posts: 1,586 Location: Scottsdale, AZ
|
Can you email me a copy of your page and upload handler .aspx and codebehind? chrish at krystalware dot com. I'll take a look and get back to you.
|
|
|
|
Guest |