Hey Everbody,
I very new to ASP.NET and I'm still trying to get a grasp on all the .NET class stuff. I am building an image Upload/Resize/Crop/Delete interface. The image files will be saved on the files system and tracked with XML records.
As I said, I'm very new to ASP.NET and I've done alot of forum searching and what-not. this is my first Forum Post on the topic. I hope not to confuse, but I'm confused.
So far my page will upload the images to the file system directly, and seperately I can edit the images and post them into the XML file. I would like to be able to pass the File Name, File Path, Thumbnail Name & Thumbnail Path into a data column of each record in the XML file representing the file that was just uploaded.
BTW: I'm using a cool application called Radactive iLoad for the image editing. With a little tweeking, I can load the edited images into the XML file as it saves the file onto the File System. However I want to have a simpler method through the FileUpload control. How do I get the file attributes of the uploaded file to populate into the XML?
I noticed that that PostedFile.FileName will get the Fully Qualified Name and I can use the System.IO.Path.GetFileName to use only the name of the file and not the entire path. How do I then pass this info into a Data Column of the XML file?
I hope I have not confused, but like I said... I'm confused. I'm probably just mixing a few techniques together and it's not working out well. Anything you can tell me though would be helpful.
: )
this is all I have in my code behind, so far:
I very new to ASP.NET and I'm still trying to get a grasp on all the .NET class stuff. I am building an image Upload/Resize/Crop/Delete interface. The image files will be saved on the files system and tracked with XML records.
As I said, I'm very new to ASP.NET and I've done alot of forum searching and what-not. this is my first Forum Post on the topic. I hope not to confuse, but I'm confused.
So far my page will upload the images to the file system directly, and seperately I can edit the images and post them into the XML file. I would like to be able to pass the File Name, File Path, Thumbnail Name & Thumbnail Path into a data column of each record in the XML file representing the file that was just uploaded.
BTW: I'm using a cool application called Radactive iLoad for the image editing. With a little tweeking, I can load the edited images into the XML file as it saves the file onto the File System. However I want to have a simpler method through the FileUpload control. How do I get the file attributes of the uploaded file to populate into the XML?
I noticed that that PostedFile.FileName will get the Fully Qualified Name and I can use the System.IO.Path.GetFileName to use only the name of the file and not the entire path. How do I then pass this info into a Data Column of the XML file?
I hope I have not confused, but like I said... I'm confused. I'm probably just mixing a few techniques together and it's not working out well. Anything you can tell me though would be helpful.
: )
this is all I have in my code behind, so far:
Code:
Partial Class PhotoMGR
Inherits System.Web.UI.Page
Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)
Dim MyPath, MyName As String
MyPath = Server.MapPath("/PHOTOS/")
MyName = Dir(MyPath, vbDirectory)
If MyName = "" Then
MkDir("PHOTOS")
Span2.InnerHtml = "A Folder (PHOTOS) was created at the opening of this page."
End If
Dim objdata as New DataSet
Try
objdata.ReadXML(Server.Mappath("/APP_DATA/PhotoStor.xml"))
datagrid1.Datasource = objdata
datagrid1.Databind()
Catch
CreateXML
End Try
Sub Upload_Click(ByVal Sender As Object, ByVal e As EventArgs)
FileName.InnerHtml = MyFile.PostedFile.FileName
FileContent.InnerHtml = MyFile.PostedFile.ContentType
UploadDetails.visible = True
Dim strFileName As String
strFileName = MyFile.PostedFile.FileName
Dim c As String = System.IO.Path.GetFileName(strFileName)
End Sub
End Sub
Sub CreateXML
Dim objdata as New DataSet("root")
Dim dt as New DataTable("record")
Dim dr as DataRow
dt.Columns.Add(New DataColumn("aid"))
dt.Columns.Add(New DataColumn("filename"))
dt.Columns.Add(New DataColumn("tagname"))
dt.Columns.Add(New DataColumn("brand"))
dt.Columns.Add(New DataColumn("desc"))
dt.Columns.Add(New DataColumn("fileloc"))
dt.Columns.Add(New DataColumn("brandimg"))
dr=dt.NewRow()
dr(0)="1"
dr(1)="No Data"
dr(2)="No Data"
dr(3)="No Data"
dr(4)="No Data"
dr(5)="No Data"
dr(6)="No Data"
dt.Rows.Add(dr)
objdata.Tables.Add(dt)
datagrid1.datasource=objdata
datagrid1.databind()
objdata.WriteXML(Server.mappath("/APP_DATA/PhotoStor.xml"))
LoadXML()
End Sub