move an image file from folder to another
in a layout, once the user insert an image in a container i would like to move physically this image (windows file) from the "source" folder to another folder.
You can insert an image into the database or store a reference to the image's location
How do I recreate a file reference for a container field?http://help.filemaker.com/app/answers/detail/a_id/549/~/recreating-file-references-for-container-fields
container has a reference path to a file?container has a reference path to a file?
Container image reference issue across system platformsContainer image reference issue across system platforms
http://filemakertoday.com/com/showthread.php/28224-image-file-name-pathI'm assuming that given you wish to obtain the file path as well as filename, that you are storing your images via reference in the container fields. If this is indeed the case, then when you evaluate a container field as if it were a text field, you can obtain both pieces of information, along with its size, for example lets say your container was called "theContainer" , if you were to create a calculation field in the table - type text - and set it to: GetAsText ( theContainer ) you might get something back like this: size:144,72 image:Aaron Wilks_Initials.png imagemac:/Macintosh HD/Users/daniel/Clients/Current/IVE/Aaron Wilks_Initials.png You'll see that the calc contains 3 different pieces of information on 3 lines. To obtain just the filename you can grab lines 2 and 3 respectively, which you can do using the GetValue function, ie to get the filename: GetValue ( Calc ; 2 ) You could also parse out the prefix if needed, ie: Substitute ( GetValue ( Calc ; 2 ) ; "image:" ; "" ) --- Note that the above 3 lines is obtained when you insert an image as a reference. If you insert a file as a reference, it would appear that you don't get the first line with the size, what is returned is 2 lines of the filename & path respectively, but other than that its pretty much the same.
Media manager plugins . MediaManagerhttp://www.filemaker.com/company/newsroom/releases/1303124.html SuperContainerhttp://www.filemaker.com/company/newsroom/releases/1303203.html TroiFilehttp://www.filemaker.com/company/newsroom/releases/1303201.html
A simple way to move a file from one location to another is to insert it into a container and then use export field contents to export a copy of the file to a new location. Export Field contents with a path specified and no field specified can even be used to delete a file if that is necessary.
even if the insert into container is by ref?
if so, when i export it into new location how can i remove it from the old one?
Export field contents creates a copy of the file from the container field regardless of storage options specified.
You'll need to put the path to the new location and old locations in separate variables.
Export field contents using the $path to the old location, but with no field specified will delete the file from its original location. (This was a trick I learned from Fenton here in this forum.)
i used Esport field contenct (PhotoTableInFM::PhotoContainerInFM)
when i trigger this script FM ask me where i want to export the file he doesn't move it
You need to use:
Set Variable [$Path ; Value: //put path or calculation that evaluates to path for exported file's name and location here ]Export Field contents [ PhotoTableInFM::PhotoContainerInFM ; "$Path"]
You click "Specify Output File" and type in the name of your $Path variable without quotes.
To provide an example from your earlier question: If you were to use:
Export Field contents [ "$Path"]
This step would delete any file with the specified name and location in $Path.
i used the script attach, i have the error:
There's no file name, Just the path. include a file name and it should work if the path is correct.
Not the same problem though the same error message.
You'll need to check your file path and make sure that A) it is a valid path, even one letter wrong will fail and B) you have "write" permission to write to the Regular folder.
Since this seems to be a path to the documents folder, you might simplify this expression to be:
Get ( DocumentsPath ) & "CPEL-Archive/ARPIC/DB Bakup/Regular/2.jpg"
You also might try:
Get ( DesktopPath) & "2.jpg"
as a temporary test.
A) I'm taking (copy/paste) the path and put it in windows explorer (C:/Users/Wissam/Documents/CPEL-Archive/ARPIC/DB Bakup/MEDIUMtest/18.jpg) and the image is open !
B) i have full permission on the folder
C) i tried Get ( DesktopPath) & "2.jpg", so i what it happen is that the image is copied on the desktop, i didn't get an error
so my question: why it doesn't work wiht the folder path? and why in point C, i have a copy photo and not a move.
the path of the desktop was:
may be shoud we put / before c:
it works !
i should put a slash (/) before the c:/
Glad you got it to work. The get (desktoppath) option was intended to put the file on the desk top. Not where you wanted it, but a quick test to rule out other possible issues so that we could remain focused on the picky details required to get a valid desktop path.
Retrieving data ...