dbotton
09-19-2002, 10:15 AM
Hi Experts,
When I use getfolder method in ASP code, if I pass a path string containing spaces, it returns the message
"Technical Information (for support personnel)
Error Type:
Microsoft VBScript runtime (0x800A004C)
Path not found"
What I need to do is the next thing:
the web application final user wants to publish a picture file that the application will analyze (extension, sizex, sizey, colors, sizeKB) and then insert into a database using SAFileUp product.
So the user selects from a simple html form its file using a browse button. once the file selected, I can get the filename and filepath string and store them in variables. I do now pass the filepath string (of the selected picture) to getfolder in order to then getfile information using file method for the filesystemobject created and the folder object created.
Unfortunatelly, all this works only if the user has selected a file located in a folder that depends on a "regular" path, this means there must not be any space character in the path string.
In Windows environment, the user will want to select a file located for instance in "C:\My pictures". So What I need is to be able to user this kind of path strings that have spaces in it, and not only "C:\Mypictures"
Anyone has done this before or could help me on this ?
(I only know how to get picture information from a file using asp filesystem object. Any other way to do this is welcome also)
Thanks in advance
Best regards
Dan
part of the code:
dim filename
dim filepath
filename="photo.jpg"
filepath=ucase("C:\My Documents And Settings\Photos")
dim objFSO, objF, objFC
dim f1, w, h, c, strType
dim nombremascarafichero
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Set objF = objFSO.GetFolder(Server.MapPath("/"))
Set objF = objFSO.GetFolder(filepath)
Set objFC = objF.Files
For Each f1 in objFC
nombremascarafichero = ucase(f1.name)
response.write(nombremascarafichero & "<BR>")
response.write(ucase(filename) & "<BR>")
if nombremascarafichero=ucase(filename) then
if instr(ucase(f1.Name), ".JPG") then
response.write " <tr> <td> F1.name=" & f1.name & " </td> <td> " & f1.DateCreated & _
" </td> <td> " & f1.Size & " </td> <td> <br> "
response.write ("f1.path=" & f1.path & "<BR><BR>")
dim taille
taille=f1.size
dim nombrecompleto
nombrecompleto = filepath+filename
response.write ("Nombrecompleto=" & nombrecompleto & "<BR>")
if gfxSpex(nombrecompleto, w, h, c, strType) = true then
response.write("LARGEUR: " & w & "<BR>")
response.write("LONGUEUR: " & h & "<BR>")
response.write w & " x " & h & " " & c & " colors</td>"
else
response.write " </td><td align=""center"">bad image</td>"
end if
end if
end if
Next
set objFC = nothing
set objF = nothing
set objFSO = nothing
When I use getfolder method in ASP code, if I pass a path string containing spaces, it returns the message
"Technical Information (for support personnel)
Error Type:
Microsoft VBScript runtime (0x800A004C)
Path not found"
What I need to do is the next thing:
the web application final user wants to publish a picture file that the application will analyze (extension, sizex, sizey, colors, sizeKB) and then insert into a database using SAFileUp product.
So the user selects from a simple html form its file using a browse button. once the file selected, I can get the filename and filepath string and store them in variables. I do now pass the filepath string (of the selected picture) to getfolder in order to then getfile information using file method for the filesystemobject created and the folder object created.
Unfortunatelly, all this works only if the user has selected a file located in a folder that depends on a "regular" path, this means there must not be any space character in the path string.
In Windows environment, the user will want to select a file located for instance in "C:\My pictures". So What I need is to be able to user this kind of path strings that have spaces in it, and not only "C:\Mypictures"
Anyone has done this before or could help me on this ?
(I only know how to get picture information from a file using asp filesystem object. Any other way to do this is welcome also)
Thanks in advance
Best regards
Dan
part of the code:
dim filename
dim filepath
filename="photo.jpg"
filepath=ucase("C:\My Documents And Settings\Photos")
dim objFSO, objF, objFC
dim f1, w, h, c, strType
dim nombremascarafichero
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Set objF = objFSO.GetFolder(Server.MapPath("/"))
Set objF = objFSO.GetFolder(filepath)
Set objFC = objF.Files
For Each f1 in objFC
nombremascarafichero = ucase(f1.name)
response.write(nombremascarafichero & "<BR>")
response.write(ucase(filename) & "<BR>")
if nombremascarafichero=ucase(filename) then
if instr(ucase(f1.Name), ".JPG") then
response.write " <tr> <td> F1.name=" & f1.name & " </td> <td> " & f1.DateCreated & _
" </td> <td> " & f1.Size & " </td> <td> <br> "
response.write ("f1.path=" & f1.path & "<BR><BR>")
dim taille
taille=f1.size
dim nombrecompleto
nombrecompleto = filepath+filename
response.write ("Nombrecompleto=" & nombrecompleto & "<BR>")
if gfxSpex(nombrecompleto, w, h, c, strType) = true then
response.write("LARGEUR: " & w & "<BR>")
response.write("LONGUEUR: " & h & "<BR>")
response.write w & " x " & h & " " & c & " colors</td>"
else
response.write " </td><td align=""center"">bad image</td>"
end if
end if
end if
Next
set objFC = nothing
set objF = nothing
set objFSO = nothing