|
Rank: Newbie Groups: Member
Joined: 9/24/2007 Posts: 9
|
I have added an AjaxUploader control to my webpage, configured all of the settings and the TempFileLocation is set to /temp/UploadedFiles/
As soon as I upload a file to the web server, I get three files: .data, .info and a .status file. The names appear to be encrypted and the extensions are changed from the original filename (ex. I uploaded a pdf file) to .data. Where does the uploaded file go? Is there a property I am missing? I would like to have it moved to the /uploadedfiles/ directory, but it seems to linger around the temp folder for some reason, even after the upload is complete.
In addition to this, the .status files seem to stay there, even after the user chooses to delete the uploaded file through the ajaxuploader control. Is it possible to have these things automatically delete after a set period of time. If this is something I have to do manually, that's fine, I would just like a little clarification.
Thank you,
Br
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, As the name implies, TemplateFileLocation is only for the uploader to store the file temporarily. Usually you would handle FileUploaded event to move the file to a permanent location and rename it when you move it. You don't need to worry about the .status file. You can find more details here: http://www.essentialobjects.com/ViewDoc.aspx?t=EO.Web.AJAXUploader.TempFileLocation.htmlThanks
|
|
Rank: Newbie Groups: Member
Joined: 9/24/2007 Posts: 9
|
I used the System.IO.File.Move method to move the file, it seems to work... the only problem I have left is determining what extension (ex. pdf, txt, gif, etc..) to put on the new file name.
any idea how to do that? After that is figured out, I have this thing working. :)
Thanks again,
Br
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
|
|
Rank: Newbie Groups: Member
Joined: 1/9/2008 Posts: 5
|
I used the next code and works well:
======================================================= IN aspx file:
<eo:AJAXUploader runat="server" id="AJAXUploader1" Width="400px" TempFileLocation="~/eo_upload" MaxDataSize="50" AllowedExtension=".jpg|.gif" AutoPostBack="true" OnFileUploaded="AJAXUploader1_FileUploaded"> </eo:AJAXUploader>
======================================================= IN aspx.vb file:
Imports System.IO
...
Public Sub AJAXUploader1_FileUploaded(ByVal sender As Object, ByVal e As System.EventArgs) Handles AJAXUploader1.FileUploaded 'Get all the posted files Dim files As EO.Web.AJAXPostedFile() = AJAXUploader1.PostedFiles
Dim path1 As String Dim path2 As String
Dim s As String = String.Empty Dim f As String = String.Empty
Dim archivo As eo.web.AjaxPostedFile
'Para un solo archivo.: For Each archivo In files s = System.IO.Path.GetFileName(archivo.TempFileName) f = System.IO.Path.GetFileName(archivo.ClientFileName) Next archivo
path1 = "c:\inetpub\wwwroot\server\eo_upload\" & trim(s) path2 = "c:\inetpub\wwwroot\server\folder\" & trim(f)
If Not File.Exists(path2) Then If File.Exists(path1) Then System.IO.File.Move(path1, path2) End If End If
End Sub 'AJAXUploader1_FileUploaded =======================================================
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Thanks for sharing!
|
|