I'm trying to save the entire image web server path into MYSQL along with the filename from the upload file action. Right now I only have the file name even though the value that's getting stored in SQL doesn't have the time stamp appended to it like it does on the file system itself.
So instead of just having "jpeg.jpg" stored in the SQL table I want "/var/www/my_website/images/20180619135040_jpeg.jpg".
What's the best way to do this in v6? I've seen some tutorials in v4 and v5 but nothing on v6.
I was able to get the correct file name to be stored in the database but I still need to get the full folder path to be appended to the filename and stored in the same column in the database. I cannot find any other threads that explain how to do this in v6.
I figured it out.
You need to have a custom code section with the following code.
<?php
$path = $this->get("upload15.file1.path","path not found");
$filename = $this->get("upload15.file1.filename","filename not found");
$name = $this->get("upload15.file1.name","name not found");
$size = $this->get("upload15.file1.size",0);
$this->data("path",$path,true);
$this->data("filename",$filename,true);
$this->data("name",$name,true);
$this->data("size",$size,true);
?>
You can use {var:file_upload_action.file_you_uploaded.path} and it will get the full path, correct filename (with timestamp) and extension.
So for example, in your Override on insert part of your save data action, you could put
path:{var:upload73.file65.path}
filename:{var:upload73.file65.filename}
name:{var:upload73.file65.name}
size:{var:upload73.file65.size}
Although really why would you want to save all of that, just save the path variable.
If you need to save a bunch of these, use a loop event with the data source being {var:upload_action_name} and in the body have a save data action and your override would then be
filepath:{var:loop_event_name.row.path}
That's really useful information @healyhatman. I was wondering how to use the short codes to accomplish what I needed.
The reason I'm saving this stuff in the database that way is because I'm using a fabrik list to display the information after it's saved into the database. The list required the complete path to the file to display the media.
But your answer is awesome and I appreciate your response.