Markus: Dateiupload auf Server und in Access DB

Beitrag lesen

Hab inzwischen folgendes gefunden:

Response.Write("Path=" & MyUpLoad.Files.Item("FILE1").FilePathName

gibt mir den kompletten Pfad zurück...

möchte aber nur den Namen:

Hab folgende Dinge zur Auswahl:

ASPSMARTUPLOAD : DOCUMENTATION File Object Last modified: August 1st, 1999 © 2000 Advantys. All rights reserved. TOP

Name

The Name property contains the value of the attribute NAME of the  <INPUT TYPE='file'> Tag.

Syntax .Name

Return Value Returns a String value.

Example <% Response.Write("Name=" & MyUpLoad.Files.Item(2).Name) %>


FileName

The FileName property contains the name of the file.

Syntax .FileName

Return Value Returns a String value.

Example <% Response.Write("FileName=" & MyUpLoad.Files.Item(2).FileName) %>


FileExt

The FileExt property contains the extension of the file.

Syntax .FileExt

Return Value Returns a String value.

Example <% Response.Write("Extension=" & MyUpLoad.Files.Item(2).FileExt) %>


FilePathName

The FilePathName property contains the full path of the file.

Syntax .FilePathName

Return Value Returns a String value.

Example <% Response.Write("Path=" & MyUpLoad.Files.Item(2).FilePathName) %>


ContentType

The ContentType property contains the Content-Type of field Data.

Syntax .ContentType

Return Value Returns a String value.

Example <% Response.Write("Content-Type=" & MyUpLoad.Files.Item(2).ContentType) %>


ContentDisp

The ContentDisp property contains the content-disposition of field Data.

Syntax .ContentDisp

Return Value Returns a String value.

Example <% Response.Write("Content-disposition=" & MyUpLoad.Files.Item(2).ContentDisp) %>


Size

The Size property contains the file's size.

Syntax .Size

Return Value Returns a Long value.

Example <% Response.Write("Size=" & MyUpLoad.Files.Item(2).Size) %>


ContentString

The ContentString property contains contents of the file.

Syntax .ContentString

Return Value Returns a String value.

Example <% Response.Write("Contents=" & MyUpLoad.Files.Item(2).ContentString) %>


TypeMIME

The TypeMIME property contains the Type of the file (application, audio, image,multipart, text, video, ... ).

Syntax .TypeMIME

Return Value Returns a String value.

Example <% Response.Write("MIME Type=" & MyUpLoad.Files.Item(2).TypeMIME) %>


SubTypeMIME

The SubTypeMIME property contains the sub-Type of the file.

Syntax .SubTypeMIME

Return Value Returns a String value.

Example <% Response.Write("MIME Sub-Type=" & MyUpLoad.Files.Item(2).SubTypeMIME) %>


IsMissing

The IsMissing property returns a boolean which indicates if user has not specified a file.

Syntax .IsMissing

Return Value Returns a Boolean value.

Example <% If MyUpLoad.Files.Item(2).IsMissing Then     Response.Write("There is no specified file.") End If %>


BinaryData

The BinaryData property contains the byte corresponding to the table index containing the transmitted data.

Syntax .BinaryData (lngIndex)

Return Value Returns a byte value.

Parameter lngIndex is an index of the byte's array.

Example <% for i=0 to MyUpload.Files.Item(2).size - 1     Response.Write( Chr( MyUpLoad.Files.Item(2).BinaryData(MyIndex) ) ) next i %>


SaveAs

The SaveAs method saves file in the specified directory. This method always overwrites existing files.

Syntax .SaveAs (FilePathName)

Parameter FilePathName is the destination directory with the file's name. It could be a physical or a virtual path. If there is only the file's name then this one will be saved on the root directory of the web server.

Examples <% myUpload.files.item(2).saveas "c:\temp" & myUpload.files.item(2).filename myUpload.files.item(3).saveas "/docs/" & myUpload.files.item(3).filename myUpload.files.item(4).saveas "myFile.txt" %>


FileToField

The FileToField method saves file in a record af a specified DataBase.

Syntax .FileToField FieldName

Parameter FieldName is the field of the RecordSet.

Example <% myUpload.files.item(2).FileToField myRecordSet.Field("FILE") %>


© 2000 Advantys. All rights reserved.

ASPSMARTUPLOAD : DOCUMENTATION Files Object Last modified: August 1st, 1999 © 2000 Advantys. All rights reserved. TOP

Count

The Count property returns the number of elements in the collection.

Syntax .Count

Return Value Returns an Long value which is the number of elements in the collection.

Examples <% Response.Write("NbFiles=" & MyUpLoad.Files.Count) %>


TotalBytes

The TotalBytes property returns the number of bytes in the collection.

Syntax .TotalBytes

Return Value Returns an Long value which is the number of elements in the collection.

Examples <% response.Write("File's size uploaded : " & MyUpLoad.Files.TotalBytes ) %>


Item

The Item method access to a item in a collection. This is the default method of the collection object.

Syntax .Item(key)

Return Value Returns a file object of the collection corresponding to the key.

Examples <% For intI=1 to MyUpLoad.Files.count Response.Write("ItemID=" & MyUpLoad.Files.Item(intI).Name) Next

For intI=1 to MyUpLoad.Files.count Response.Write("ItemID=" & MyUpLoad.Files(intI).Name) Next

Response.Write("ItemID=" & MyUpLoad.Files("myFILE").Name) %>


© 2000 Advantys. All rights reserved.

ASPSMARTUPLOAD : DOCUMENTATION Form Object Last modified: August 1st, 1999 © 2000 Advantys. All rights reserved. TOP

Count

The Count property returns the number of elements in the collection.

Syntax .Count

Return Value Returns an Long value which is the number of elements in the collection.

Example <% Response.Write("NbForm=" & MyUpLoad.Form.Count) %>


Item

The Item method access to a item in a collection. This is the default method of the collection.

Syntax .Item(key)

Return Value Returns a Item object of the collection corresponding to the key.

Parameter key could be either a long value or either a string.

Examples <% For intI=1 to MyUpLoad.Form.count     Response.Write("Item=" & MyUpLoad.Form.Item(intI).Name) Next

For intI=1 to MyUpLoad.Form.count     Response.Write("Item=" & MyUpLoad.Form(intI).Name) Next

Response.Write("Item=" & MyUpLoad.Form("myTEXT").Name) %>


© 2000 Advantys. All rights reserved.

ASPSMARTUPLOAD : DOCUMENTATION Item Object Last modified: August 1st, 1999 © 2000 Advantys. All rights reserved. TOP

Count

The Count property return the number of values for this Item.

Syntax .Count

Return Values Returns a Long value.

Examples <% For each Item In MyUpload.Form     Response.Write ("Number =" & MyUpLoad.Form(Item).Count & "<br>") Next %>


Name

The Name property specifies the name for this Item.

Syntax .Name

Return Values Returns a String value.

Examples <% For intI=1 to MyUpload.Form.Count     Response.Write ("Name=" & MyUpLoad.Form.Item(intI).Name & "<br>") Next %>


Values

The Values property specifies the values for this Item. If there are several tag with the same name, or a tag accept multiple values, then the property without parameter returns a list of values.

Syntax .Values ([lngIndex])

Return Values Returns a String value.

Parameter lngIndex is an optional parameter. Then the property returns the value corresponding to the index.

Examples <% For intI=1 To MyUpload.Form.Count     Response.Write ("Name=" & MyUpLoad.Form.Item(intI).Values(1) & "<br>")     Response.Write ("Name=" & MyUpLoad.Form.Item(intI).Values & "<br>") Next

For each Item In MyUpload.Form     Response.Write (Item & " = " & MyUpLoad.Form(Item) & "<br>") Next

For each Item In MyUpload.Form("mySELECT")     Response.Write (Item & "<br>") Next %>

MFG Markus