unable to open a picture

hi all,I am unable to open a picture ,like that
Dim f as folderItem = GetFolderItem(savePicture.NativePath) //
Dim pic As Picture =Picture.Open(f)// pic always nil

is that anybody know why?

what is savePicture ? ( a real path ?)

Dim f as folderItem = GetFolderItem(savePicture.NativePath, FolderItem.PathTypeNative) if f <> nil and f.exists then Dim pic As Picture = Picture.Open(f) Else MsgBox("we had a problem with f") End If

@Axel Schneider still the same, f(filepicture) exists ,but can’t open as picture

[quote=378508:@xiaoxia ning]hi all,I am unable to open a picture ,like that
Dim f as folderItem = GetFolderItem(savePicture.NativePath) //
Dim pic As Picture =Picture.Open(f)// pic always nil

is that anybody know why?[/quote]

How are you getting the SavePicture ?

Try this

[code]Dim savepicture As folderitem
Dim j As New OpenDialog

savepicture = j.ShowModal

If savepicture <> Nil Then

Dim pic As picture = picture.open(savepicture)

label1.Text = Str(pic.width)+" x "+Str(pic.height)

End If [/code]

@Edwin Lau I want to upload a picture and show it ,

Dim uploadedPicture As Picture
Dim savePicture As FolderItem
For Each uFile As WebUploadedFile In files
Try

If uFile.File <> Nil Then
  uploadedPicture = Picture.Open(uFile.File)     
Else
  // The file is in memory.
  uploadedPicture = Picture.FromData(uFile.Data)
End If

// Now save the file to disk in our upload folder
savePicture = uploadFolder.Child(uFile.Name)  
uFile.Save(savePicture)

Catch err As UnsupportedFormatException
// not a picture, so skip it
Continue

Catch err As IOException
MsgBox("Upload failed: Insufficient permissions to save files to " + uploadFolder.NativePath)
Exit For
End Try

Next

uploadedPicture = Picture.Open(savePicture) // nil pic always nil
ImageView1.Picture = uploadedPicture //

Please read the documentation. http://documentation.xojo.com
It tells you exactly why the picture is nil.

@Tim Parnell Can you tell me more details

http://documentation.xojo.com/index.php/WebUploadedFile
http://documentation.xojo.com/index.php/WebFileUploader

For one thing, the image format must be supported on the platform where the server is running. for Instance, our framework does not support Targa pictures and trying to open one would result in p being Nil.