Welcome Guest Search | Active Topics | Sign In | Register

Accessing files with AjaxUploader Options
breese
Posted: Saturday, February 2, 2008 11:26:44 AM
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
eo_support
Posted: Saturday, February 2, 2008 11:33:10 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
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.html

Thanks
breese
Posted: Saturday, February 2, 2008 1:11:46 PM
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
eo_support
Posted: Saturday, February 2, 2008 1:15:41 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Hi,

You can use this property to determine the original file name/extension:

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

Thanks
FERNANDO LOZANO
Posted: Monday, February 18, 2008 10:28:57 AM
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
=======================================================
eo_support
Posted: Monday, February 18, 2008 11:07:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,096
Thanks for sharing!


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.