Welcome Guest! You need to login or register to make posts.

Notification

Icon
Error

Options
Go to last post Go to first unread
derekmhart  
#1 Posted : Saturday, March 13, 2010 1:44:49 PM(UTC)
derekmhart

Rank: Member

Groups: Member
Joined: 3/13/2010(UTC)
Posts: 13

Where is the temp directory when using Image Uploader. I have looked all over the documentation for this. I assume I can change it in web.config. How?

And I have not found any material on what happens to these temp files if the process gets interrupted and never get properly saved.

And when they are saved, I assume the temp file disappears?

Edited by user Saturday, March 13, 2010 2:06:54 PM(UTC)  | Reason: Not specified

Fedor  
#2 Posted : Monday, March 15, 2010 10:57:50 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Derek,

Quote:
Where is the temp directory when using Image Uploader. I have looked all over the documentation for this. I assume I can change it in web.config. How?

And I have not found any material on what happens to these temp files if the process gets interrupted and never get properly saved.

And when they are saved, I assume the temp file disappears?


Image Uploader uses standard ASP.NET file upload approach. It means that you have an access to the uploaded files using Request.Files[] collection only.

You can also process files using Aurigma.ImageUploader.FileUploaded event handler and its args of Aurigma.ImageUploader.FileUploadEventArgs type.

In this case FileUploadEventArgs class just encapsualtes the access to Request.Files[] collection.

As ASP.NET infrastracture handles upload automatically and doesn't provide direct access to uploaded files dumped to disk (small files are not dumped at all), you should specify in your code where you want to save the uploaded file.

For example, please check Handling Upload paragraph of Inserting Image Uploader ASP.NET Control into ASP.NET Page topic. In short you can save files using the following code:

Code:
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, System.EventArgs e)
    {

    }

    protected void FileUploaded(object sender, Aurigma.ImageUploader.FileUploadEventArgs e)
    {
        string galleryPath = "Gallery/";
        string thumbnailsPath = galleryPath + "Thumbnails/";

        Aurigma.ImageUploader.SourceFileInfo sourceFile = e.SourceFile;
        Aurigma.ImageUploader.ThumbnailInfo thumbnail = e.Thumbnails[1];

        string safeFileName = sourceFile.GetSafeFileName(Server.MapPath(galleryPath));

        sourceFile.Save(Server.MapPath(galleryPath + safeFileName));
        thumbnail.Save(Server.MapPath(thumbnailsPath + safeFileName));
    }
}

Edited by user Monday, March 15, 2010 10:59:45 AM(UTC)  | Reason: Not specified

Best regards,
Fedor Skvortsov
derekmhart  
#3 Posted : Monday, March 15, 2010 2:43:22 PM(UTC)
derekmhart

Rank: Member

Groups: Member
Joined: 3/13/2010(UTC)
Posts: 13

From what I read here, it seems like I don't have access to where the temp files are stored. But my website will potentially have thousands of users uploading files. I have to create a very large disk for this. What if the upload gets interrupted, do I have to delete these manually, or do they disappear after a period of time?

Or do I have to learn about how to set the location that ASP.NET itself stores uploaded temp files?
Fedor  
#4 Posted : Tuesday, March 16, 2010 5:09:22 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Quote:
From what I read here, it seems like I don't have access to where the temp files are stored. But my website will potentially have thousands of users uploading files. I have to create a very large disk for this. What if the upload gets interrupted, do I have to delete these manually, or do they disappear after a period of time?

Or do I have to learn about how to set the location that ASP.NET itself stores uploaded temp files?


ASP.NET infrastructure automatically deletes temp files. You don't need to take care about it.

You should save the upload files in the final location using SaveAs method or InputStream property. If you didn't do it, the files are deleted automatically.

Best regards,
Fedor Skvortsov
derekmhart  
#5 Posted : Tuesday, March 16, 2010 9:45:56 AM(UTC)
derekmhart

Rank: Member

Groups: Member
Joined: 3/13/2010(UTC)
Posts: 13

OK, thanx for answering that. However, if I have thousands of users, I could potentially need a huge disk, such as a couple terabytes for storage of these temp files. Please elaborate on how I would solve that. 5000 users simultaneously uploading files could easily produce 2 terabytes of temp file storage, even though they will shortly disappear.

Edited by user Tuesday, March 16, 2010 9:46:37 AM(UTC)  | Reason: Not specified

Fedor  
#6 Posted : Tuesday, March 16, 2010 11:32:05 AM(UTC)
Fedor

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 7/28/2003(UTC)
Posts: 1,660

Thanks: 5 times
Was thanked: 76 time(s) in 74 post(s)
Derek,

Quote:
OK, thanx for answering that. However, if I have thousands of users, I could potentially need a huge disk, such as a couple terabytes for storage of these temp files. Please elaborate on how I would solve that. 5000 users simultaneously uploading files could easily produce 2 terabytes of temp file storage, even though they will shortly disappear.


Most probably you should use Web farm to serve ~5000 users where each server should have its own temp directory.

If it doesn't meet your requirements, then you can implement a custom HttpModule to process uploaded files without creation of temporary files.
Best regards,
Fedor Skvortsov
Users browsing this topic
Guest
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.