WB 17 Upload problem

Startbeitrag von Piet van Zanten am 28.03.2013 15:23

Hi,

The webdev upload control is based on Flash.
This is a problem, because many (mostly Apple Safari) users don't have flash installed.
I need my site to be compatible with all major browsers.
The upload control does not work with embedded SWF object (confirmed by PCsoft)
I'm not eager to use a script that prompts the user to install Flash.

So for now I'm still using the simple html upload, which works o.k., but very basic of course and I fear that users may encounter timeouts on slow connections.
There are many plugins that don't use Flash, but I expect doing the server side stuff in Webdev (Classic) will not be easy if not impossible.

Has anybody solved this upload problem in a classic Webdev site in a more elegant way and is willing to share some insights?

Regards,
Piet

Antworten:

Hi Piet,

uploading large files in webdev is IMHO not possible out of the box.

I use a JAVA based upload tool. It works very good, also with files up to 4 GB.

But JAVA and FLASH have the same disadvantages: You must it install before, and it is not part of your browser ...

von Michael Drechsel - am 28.03.2013 16:38
Hi everybody

my experience has been that you can upload file as big as you need with the basic control, as long as the server is correctly configured (several time out/limits to set up)...

Apart for that, I have never needed to use a more advanced control yet (and I agree that the flash one is a poor solution)...

Unfortunately, on a theoretical standpoint, the browser will PREVENT anything that is not INSTALLED on the user machine to access the disk and select the files to upload...

Transmitting them wouldn't be that much of a problem with a loop on an ajaxexecute, but slecting them and reading them from disk requires bypassing the browser sandbox/security, which means flash, java, an activeX or something similar installed on the clients machine/browser.... I do no think that there is any way around that problem (and that's good, otherwise security would be a MAJOR problem)

Best regards

von Fabrice Harari - am 28.03.2013 20:06
Hi Fabrice,

I expressed my concern about timeouts, however that was not correct, I have a timer to keep the session alive.

My concern is actually:
- There's no progressbar, which may lead users to believe nothing is happening so they disconnect or browse back.
- I cannot limit the file size, I can only check it once uploaded.
- The appearance of the control differs in all browsers: the button text is different and the button cannot be styled.
If these points could be taken care of, I would be perfectly happy with the html upload.

Regards,
Piet

von Piet van Zanten - am 29.03.2013 11:37
Hi Piet

I haven't tried, but here are some ideas to address these points:
- progressbar: as you have a timer to keep the session alive, you could use ajaxexeuteasynchronous to ASK the server about the size of the uploaded file in the temp directory and display it locally (even if you don't know the whle size)
- limiting the file size: I found this via google (but for whatever reason I doubt it will work in all browsers) http://www.tizag.com/htmlT/htmlupload.php
- the upload control style SHOULD be modifiable via css or similar... In fact, a quick google search gave me this link (and many others):
http://the-echoplex.net/log/how-to-style-a-html-file-upload-control-using-css-and-javascript


So there ARE ways to improve the process if needed, but they may not be very easy

von Fabrice Harari - am 29.03.2013 12:53
Hi Fabrice,

Thanks for sharing your thoughts.
Of course I already did the Google search, but as you say it may not be very easy.
I'll dig a bit deeper if time and space allow ;-)

Do you by any chance know how an Ajax upload request like this can be handled by a WB page?
// start upload
xhr.open("POST", $id("upload").action, true);
xhr.setRequestHeader("X_FILENAME", file.name);
xhr.send(file);

Another option would be to use a PHP page for this, but if possible I'd prefer Webdev.

Best regards, Piet

von Piet van Zanten - am 30.03.2013 10:45
Hi,

I have done some more research and found the following;

1. Show progress. A very simple solution is to create a hidden cell containing an animated progress image and a message saying "uploading, please wait..." and make it visible when clicking the upload button (Why didn't I think of this before)
The user will see no real progress, but at least will see that something is happening.

2. The suggested hidden input named MAX_FILE_SIZE is a directive for PHP, so it only works with PHP (on the server side, as an addition to the generic server limit) . A generic solution for Webdev is to set the MAX_UPLOAD registry key for the Webdev server.
EDIT: hmm, the PCSOFT registry keys cannot be found, I wonder where they are? Do I have to create it from scratch?

3. Styling looks too complicated, since the html file input does not have css styling properties. It requires overlaying other html controls, so I will leave it as is for now.

Regards,
Piet

von Piet van Zanten - am 30.03.2013 12:14
Hi Piet

UPLOADING, per se is not the problem as it can be done either via ajaxexecute function or via a httprequest to an awp page of the site..

The problem is at the level of SELECTING the file and READING it from disk, both FORBIDDEN operations iin a browser...

So by example:
https://developer.mozilla.org/en-US/docs/Using_files_from_web_applications
Is a system allowing to do that but only in HTML 5 capable browsers...

If you are able to implement a system to READ the file, sending it is easy enough:
- cut it in packets
- send a packet
- increase the counter visible by the user
- on the server, receive packet, add at the end of file, rename, done

Best regards

von Fabrice Harari - am 01.04.2013 16:30
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.