Welcome Guest Search | Active Topics | Sign In | Register

AJAX Uploader Set FileName+Path Options
Marc
Posted: Monday, July 23, 2007 9:38:56 PM
Rank: Newbie
Groups: Member

Joined: 7/23/2007
Posts: 5
How would I dynamically set the filename when an image is uploaded? My site has a profile for each user and a user can upload multiple images is why I need to do this.

Also, if two users concurrently upload a file, how is the tempFile handled? Do I need to dynamically name the tempfile as well so that one user doesnt step on another?
eo_support
Posted: Tuesday, July 24, 2007 6:02:36 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Marc,

With our uploader control you do not set the file name, you set the temp file directory instead.

At runtime, the uploader creates a unique file name inside that directory everytime a user upload a file. So no matter how many users are uploading concurrently, the files won't overwrite each other.

Once the files are transfered, you will need to move/renames those temp files to your desired locations/names. You can get the original file name from this property:

http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.AJAXPostedFile.ClientFileName.html

Thanks
Marc
Posted: Tuesday, July 24, 2007 9:19:47 AM
Rank: Newbie
Groups: Member

Joined: 7/23/2007
Posts: 5
Sounds great, that will work!

Thanks
Marc
Posted: Tuesday, July 31, 2007 8:15:54 PM
Rank: Newbie
Groups: Member

Joined: 7/23/2007
Posts: 5
eo_support wrote:

Once the files are transfered, you will need to move/renames those temp files to your desired locations/names. You can get the original file name from this property:

http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.AJAXPostedFile.ClientFileName.html

Thanks


Hmm, now having the time to download the demo, what is the point of having the option to "delete" a temporary file if after the upload I have to copy/move/rename it anyway, if someone tries to delete the temp file it wont be there. Shouldnt there be a way to either not show the delete option with its text and or the ability to tie the delete button into deleting the actual image not the temp image?
eo_support
Posted: Tuesday, July 31, 2007 8:36:56 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Marc,

You are confusing "deleting by you" and "deleting by your user". When your user upload files, before he/she finally submits it to you, he/she ought to have the option to removes files that he has uploaded, but does not want to submit. For example, use uploads file A, B, C, then delete B, then submit, at this point your code is called, and your code will only see A and C, you would never know that B has actually been uploaded but was subsequentially deleted by your user.

Having that said, you can easily customize the layout to remove the delete button. You will need to edit the uploader's LayoutTemplate property:

http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.AJAXUploader.LayoutTemplate.html

Once you edit layout template, you will see the default layout. Switch to HTML view and you will be able to change it however way you wanted.

Thanks
Marc
Posted: Tuesday, July 31, 2007 10:25:18 PM
Rank: Newbie
Groups: Member

Joined: 7/23/2007
Posts: 5
eo_support wrote:
For example, use uploads file A, B, C, then delete B, then submit


Since I've never seen a submit button in the demos I had no idea that would be the process. Ideally, after the user uploads they should probably see the image right there. And interacting with that image (deleting) would be integrated. It seems to truly upload an image the user needs two clicks instead of one (the upload, then a submit). Let me know if I'm off base here.
eo_support
Posted: Wednesday, August 1, 2007 6:32:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi Marc,

You didn't quite understand how our uploader works. Try to think of uploader as a "text box", with a text box, you first "enter the text" and then submit. With an uploader you first "enter the files", then submit. There are two fundamental rules here:

1. The page has to be submitted in order to fire your server side code. This is an absolute rule. There is no escape for this one;

2. The file has to be transferred before the page is submitted. This is where our uploader is special. A regular HTML file upload element "upload" and "submit" at the same time. This way the whole file (all data posted by the client, including the file) first go into memory and then your code will have to save it onto the disk. Since it first load the whole request into memory, it's impossible for you to upload extra large file, also you can not get progress information. In order to stream the data into temp files on the server side and get progress data, files have to be transferred separately than the submit (which would also contains other form data). You can find an example at here demonstrating this concept:

http://www.essentialobjects.com/Demo/Default.aspx?path=AJAXUploader\_i1

When you put the above together you would then see uploader does a two step process. However, if you set the uploader's AutoPostBack to true, it will automatically trigger the second step when the first step is done. In this case your user will only need one click.

"The should probably see the image right there" is a good idea, but I am not sure whether it should be part of our uploader. The uploader is generic file uploading tool and it is not just for images. Beside different people have different requirement, some want the image to be there, some don't. Some want it displays a small thumbnail, some want a big thumbnail and some may want a full image. Also different people have different layout design. Obviously these are just so much out of the scope of the uploader control.

Thanks
Marc
Posted: Wednesday, August 1, 2007 9:26:52 AM
Rank: Newbie
Groups: Member

Joined: 7/23/2007
Posts: 5
Now I understand, thanks!


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.