Rank: Member
Groups: Member
Joined: 7/25/2007(UTC) Posts: 17
Thanks: 3 times
|
Hi,
Is there any way to add a file without using the UI? I want to be able to select a file with a simpler UI and use the Uploader to handle the work of sending the file to the server. I use the provided UI to upload files on our site, but in some cases I only want the user to upload 1 file and don't need to utilize the Uploader UI. This way I could use the same back-end code to handle the upload. I just can't figure out how to call the same event that is attached to the "Add More Files" button. I could most likely figure it out if the aurigma.htmluploader.control.js file wasn't minimized. Is there any way I can get a copy of this file uncompressed? This would go a long way in customizing this product. If not, could you tell me how to add a file using JavaScript?
Thank you for your time. |
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
It is impossible to add an arbitrary file from JavaScript - you don't have any access to a file system from JavaScript due to the security reasons.
However in the version 8.1.15 (released yesterday) we have added an addFiles() method which displays the Open File dialog, provided that it was called from a button click event. So you can hide the uploader interface, display a single HTML button and use this method to select a file on a computer.
Something like this:
<button value="files" onclick="$au.imageUploaderFlash('Uploader1').uploadPane().addFiles(); return false;">Add Files</button>
Again, it won't work if you call it outside of a button's onclick event. Browser vendors consider displaying an Open File dialog secure only if a user interacts with a page explicitly.
BTW, the same is true for Flash, that's why this method won't work for the Flash uploader (it would require you to add a Flash button).
Hope this helps.
|
 1 user thanked Andrew for this useful post.
|
|
|
Rank: Member
Groups: Member
Joined: 7/25/2007(UTC) Posts: 17
Thanks: 3 times
|
Perfect! That was exactly what I was looking for. Thank you for your help. |
|
|
|
|
Rank: Member
Groups: Member
Joined: 7/25/2007(UTC) Posts: 17
Thanks: 3 times
|
I was able to get this working. But I do have one question. How can I restrict the multiple file select when the file dialog opens? I set the "maxFileCount" to 1, but it is still allowing me to select multiple files. |
|
|
|
|
Rank: Advanced Member
Groups: Member, Administration Joined: 8/2/2003(UTC) Posts: 876
Thanks: 2 times Was thanked: 27 time(s) in 27 post(s)
|
Tim,
Unfortunately it is not possible to disable multiple selection right now, but the idea is great. We will add it to the next update. If the (max file count - total count of upload items) = 1 the Open File dialog will be opened in a single file mode.
Sounds good?
|
|
|
|
Rank: Member
Groups: Member
Joined: 7/25/2007(UTC) Posts: 17
Thanks: 3 times
|
That sounds great! I love the support that you guys have for your products. Thank you so much for your time and help. |
|
|
|
|
Rank: Advanced Member
Groups: Member
Joined: 6/10/2013(UTC) Posts: 34
Was thanked: 1 time(s) in 1 post(s)
|
|
Best regards, Dmitri Vorobyov
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.