Hi ,
I have a php script that compresses an image on upload. It works fine as a standalone script outside chronoforms but I'm trying to create a form where it would do the same thing. So I have a simple form with (in load) views, a file field and a submit button. In the submit Action section I have the php script to compress and upload the compressed image. which works until I click submit then I get the error:
"Warning: imagejpeg(components/com_chronoforms6/chronoforms/components/com_chronoforms6/chronoforms/uploads/myimage.png):
failed to open stream: No such file or directory in /home/www/mywebsite/libraries/cegcore2/admin/extensions/chronofc/functions/php/php_output.php(6)
: eval()'d code on line 26"
I realise the file path must be wrong, but not sure how to correct it? I've tried using $path but no luck. My upload path is "// File upload path
$uploadPath = "components/com_chronoforms6/chronoforms/components/com_chronoforms6/chronoforms/uploads/";
What should the path be?
Ian
I have a php script that compresses an image on upload. It works fine as a standalone script outside chronoforms but I'm trying to create a form where it would do the same thing. So I have a simple form with (in load) views, a file field and a submit button. In the submit Action section I have the php script to compress and upload the compressed image. which works until I click submit then I get the error:
"Warning: imagejpeg(components/com_chronoforms6/chronoforms/components/com_chronoforms6/chronoforms/uploads/myimage.png):
failed to open stream: No such file or directory in /home/www/mywebsite/libraries/cegcore2/admin/extensions/chronofc/functions/php/php_output.php(6)
: eval()'d code on line 26"
I realise the file path must be wrong, but not sure how to correct it? I've tried using $path but no luck. My upload path is "// File upload path
$uploadPath = "components/com_chronoforms6/chronoforms/components/com_chronoforms6/chronoforms/uploads/";
What should the path be?
Ian
Hi Ian,
The path will be like this:
The path will be like this:
$this->get("upload_action_name.field_name.path");You need to use the correct upload_action_name and field_name
Hi Max,
Thank you, that worked and got rid of the error message but the image doesn't upload face-meh-blank
$uploadPath = $this->get("submit.image.components/com_chronoforms6/chronoforms/components/com_chronoforms6/chronoforms/uploads/uploads");
Ian
Thank you, that worked and got rid of the error message but the image doesn't upload face-meh-blank
$uploadPath = $this->get("submit.image.components/com_chronoforms6/chronoforms/components/com_chronoforms6/chronoforms/uploads/uploads");
Ian
Replace "submit" with the name of the upload file action. Unless you literally called it "submit"
Replace the giant path you have with the word "path"
Replace the giant path you have with the word "path"
the code I posted, after you update it with the variables needed, should give you the uploaded image path, which can be used in your PHP code.
Please post the debug data you get after submitting the form!
Please post the debug data you get after submitting the form!
This topic is locked and no more replies can be posted.