kostysh / File-uploading-component-for-Sencha-Touch

Ext.Button based component for uploading files in Sencha Touch apps without page refresh
51 stars 26 forks source link

Uploading images from phone #4

Closed Simonida closed 11 years ago

Simonida commented 11 years ago

Component works great when uploading files (images) from computer. But when trying to upload image from mobile phone (some with Android OS for example) whole application just freeze and stop working. Despite that image was uploaded to server.

Does anyone have any idea what is causing this problem?

kostysh commented 11 years ago

This may occur if you are trying to upload images of large size. Application from this repository (as an example) - is very simple, it does not scale images and uploaded to the server is returns in the same size (as data-url). Of course, the mobile browser is not able to quickly display a large image in this format. If you want a better performance - you should scale uploaded image to size acceptable for mobile.

Simonida commented 11 years ago

I tried to upload images with very small dimensions from phone, but it was all the same. Application just stop working. After I read your reply, I've tried resizing images automatically after upload. That worked, but there is still the same problem when uploading images from phone.

kostysh commented 11 years ago

Because of to many factors I can not give you answer why your app works so slow. I think you should debug application on smartphone (with remote debug feature) and found the source of problem. By the way, you can return only direct image url not dataUrl (url of uploaded image, transformed or not). In this case mobile browser should display image quickly

Simonida commented 11 years ago

Ok, thanks, I will try that. Just one more question. Do you mean that the image will be displayed faster if I set image src to response.url instead of response.base64?

But for example when I earlier tried to upload image using your demo app, from my phone, it was also very slow and image was never displayed on screen. In my application I wanted to use this component in the same way...

Anyway, thank you very much for your help and patience. And please excuse my bad English.

kostysh commented 11 years ago

In case of direct url (instead of base64) you should modify the application if you want to display received image. Demo does not contains this feature.

Simonida commented 11 years ago

I found the solution! I just deleted this line header('Content-Type: application/json; charset=utf-8'); in get_file.php and now everything works perfect! :)

Thanks again kostysh.

tsprings commented 11 years ago

I know this is closed, but just wanted to note that the upload was VERY slow, and when I commented out the line Simonida mentioned, the upload time went from unusable to acceptable.

kostysh commented 11 years ago

hmm, This header is sent to the browser after the file download is complete. This header shall not affect the speed of downloading files.