the user selects the file i.e. a photo,
the procedure must rename the photo with the student's matriculation number (nMatricola)
I made :
- Code: Select all Expand view
nMatricola:= oAlunno:matricola // student's matriculation number
cExt := ltrim(Right(cfotografia,4)) // the extension of file
cRelativePath:= RelativePath(cfotografia) // give the folder of file loaded
cFileNew:=cRelativePath+alltrim(nMatricola)+cExt //save the new name file with extension
to rename the file cfotografia into new file cFileNew I made
- Code: Select all Expand view
while FRename( cfotografia, cFileNew ) != 0
SysWait()
end
to save I use the copyfile function (found in fwh sample)
- Code: Select all Expand view
- AaDd(aSource,(cFileNew) )
AaDD(aTarget,cImgPath+UrlImage(cFileNew))
CopyFiles(aSource,aTarget,)
it happens that sometimes it works and sometimes it saves the file in the cImgPath folder without extension but only with the file name i.e. with the student's matriculation number (nmatricola) and then saves it in the oAlunno:foto field
- Code: Select all Expand view
- oAlunno:foto:= UrlImage(cFileNew)
oAlunno:Save()
the function RelativePath() - it gives me the name of the folder without the file
the function UrlImage() - it gives me the file name without the folder name
How I can resolve it ?