Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: Uploading

$
0
0
Re: Uploading
Web Connection 5.0
Re: Uploading
Mar. 23, 2013
05:00 pm
3QT10GD0QShow this entire thread in new window
Gratar Image based on email address
From:Rick Strahl
To:David Pedrelli

In order to upload a PDF you have to add PDF the cAllowedExtensions on the server, and add pdf to the filters list on the client as well...

IE9 will use Flash or Silverlight if either is installed or Html4 if neither is.

On my local setup it works both with Silverlight and Html4. You can try it out on the server yourself

http://localhost/wconnect/webcontrols/plUploadSample.htm

You won't be able to upload a PDF because PDFs are not allowed there, but you should be able to upload images. If it works there it should also work for you locally.

Make sure you point at the right URL on your server. Use Fiddler to see what actually comes back from those requests...

+++ Rick ---


Rick,

That is the thing. Nothing uploads. JPEGs display in the control, but do not upload. I added "pdf" to cAllowedExtensions and changed cAllowedExtensions to only "pdf." In both cases, I can add JPEGs, but not PDFs. So, even removing JPEGs, I can still add JPEGs. I was using IE 9, but I installed Firefox. I installed Firefox to use a debugger. It may take me a while to trace the code.

Firefox
The control displays immediately. Drag-and-drop works. When I add the file, there is a tooltip that says: "Using runtime: html5." It displays the file size as 40 KB. I click Start Upload. Status is 0% and I get a warning icon, with a tooltip that says "HTML error." It still lists the file in the control and says "Uploaded 0/1 files." And the buttons disappear from the bottom of the control. I have to refresh the page to start the process again.

IE 9
Takes about 20 seconds for the control to display. Drag-and-drop does not work. When I add the file, there is a tooltip that says: "Using runtime: html4." It displays 0 KB for the file size. I click Start Upload. The file is removed from the control list. I do not get a warning icon. The control says "Uploaded 0/0 files." The "Add Files" button remains enabled and I can start the whole process over again.

I assume that there is an issue with HTML4 vs HTML5.

Thanks,

David

I'm not sure. Use a JavaScript debugger to see where it hangs or is slow by stepping through the startup code I posted. This should give you an idea what's slow loading. I don't think anything is really happening just displaying the UI, unless you're linking to a URL on a slow network connection somewhere.

If images are uploading then everything is actually working. PDF files aren't working because they are excluded. You have to adjust the list of extensions that the client allows you to select and the server allows to accept (cAllowedExtensions).

+++ Rick ---


Rick,

The page loads fine. However, the plUpload component does not display for about 20 seconds. I added breakpoints to the codebehind for the two VFP methods (plUploadSample and OnUploadComplete). However, they never execute. I do not know what specifies the names of the methods executed; however, I just copied the code from your sample.

I changed the extension filter in plUploadSample
loUpload.cAllowedExtensions = "pdf"
However, if I try to add a PDF, I get an error "Invalid file extension: test.pdf."
I can add a JPG and it displays in the list. I click Start Upload. The Start Upload button becomes disabled. Uploaded 0/0 files and nothing happens.

loUpload.cUploadPath = ADDBS(THIS.oConfig.cHtmlPagePath) + "temp"
The application does create PDFs in the same directory. Also, I can use the string upload to upload to that directory.

Thanks,

David

No it's all just script on the client and basic FoxPro code, and it should load instantly. What's slow? Is it the page loading or the server hit(s)...

If nothing uploads check to see whether the requests are hitting the server and step through - to see what's slow. If it's the server it might be permissions failing or Windows redirecting files if you don't have the right write permissions in the folder in questions (UAC). Make sure the IIS application pool account has full rights in the folder you're uploading files to.

+++ Rick ---


Rick,

I downloaded plUpload from the plUpload site, copied your VFP, HTML, and JavaScript code to an app, and tested it. I have a couple of questions. I put the <div> tag on a WC Web page. It takes the plUploader about 20 seconds to display, from the point that I load the page. That does not happen on your sample or on the plUpload page. Is there a configuration setting that needs to be changed?

I can add files, but they do not upload. I see you call CREATEOBJECT. Is there an ActiveX that needs to be registered?

Thanks,

David


FWIW, I've adapted the plUpload ASP.NET code to a Web Connection handler and have added that functionality to Web Connection now.

The FoxPro sample is now online here:
http://west-wind.com/wconnect/webcontrols/plUploadSample.htm

and the documentation can be found here:
wcdocs:_3qj1500yc.htm

I've attached the plUploadHandler implementation, so you can try this out yourself if you like. I'd love to get some feedback.

You can follow the instructions in the How plUploadHandler works topic:
wcdocs:_3qj1bpfln.htm

which should have everything you need.

+++ Rick ---



Hi,

Is there a way to upload files from the client to the WC server, without the 16 MB string limit? I have to upload files, but will frequently have files larger than 16 MBs.

Thanks,

David












Rick Strahl
West Wind Technologies


from Maui, Hawaii

Making waves on the Web


Viewing all articles
Browse latest Browse all 10393

Trending Articles