I follow this documentation https://symfony.com/doc/5.4/controller/upload_file.html
I can upload a pdf file in symfony 5 in a private directory (var/uploads/brochures/).
Information i use wampserver in php 8.1.
But i'm not be able to edit this file in a blank tab browser.
Have you an idea ?
Maybe you missed this part.
Don't forget you stored your PDF in a private folder. You can't get it with the asset function.
First thanks to SuperBob and I found the solution: I modify services.yaml. like this:[![enter image description here][1]][1]
I add a route to list all products :[![enter image description here][2]][2]
In my view I loop on products and I create a route to download the PDF file :[![enter image description here][3]][3]
Before adding the route I modify Product entity like this :
[![enter image description here][4]][4]
And finaly I add my download route :
[![enter image description here][5]][5]
I hope this solution can help someone !
[1]: https://i.stack.imgur.com/wXXm7.jpg
[2]: https://i.stack.imgur.com/1g6ME.jpg
[3]: https://i.stack.imgur.com/T9AQx.jpg
[4]: https://i.stack.imgur.com/kVBPp.jpg
[5]: https://i.stack.imgur.com/RR1Mu.jpg
Related
I want to display the preview thumbnail of the multifile upload field. I had followed this thread but I found that {fileName} had some random string. It’s between {input id} and {file.target_name}.
Ex: 4a017277_input_5_zfKuGrwCd91CyiHy_o_1esroacel59uais19ev1dqa405q.png.
What is {zfKuGrwCd91CyiHy}?
tmp image's name
I had found a solution for this. It's not a beautiful way but it worked like a champ.
The random string above was rendered by a function random_str(). My solution is to remove or customizing the function.
File located at path: ../wp-content/plugins/gravityforms/includes/upload.php
enter image description here
I use wordpress template and everything was working ok till when i try to add a photo for each product but it's not working when i inspect the image the url is wrong..how to change it?
the shown url : https://localhost:81/soraya/81/soraya/wp-content/uploads/2017/07/product-19-268x290.jpg
instead of : https://localhost:81/soraya/wp-content/uploads/2017/07/product-19-268x290.jpg
Thank You!
Can anyone point me in the right direction on how to override a file that is in web/template, it's the minicart/content.html file I would like to change, i've been searching but can't find out how!
Please check the URL they are going to help you to override the template file ;
Magento 2: How to override mini-cart default template html file?
Also one more link you can follow :
how to override template files for magento2 extension
Im seeing the following message within Reports when I attempt to use the image_style_url function on an image : "Unable to generate the derived image located at public://..."
I have ensured that the directory is under Apache's ownership and I have no problems attaching images for upload to other nodes.
The style name "template" has been set up within the "Image Styles" menu in the Drupal Administration panel.
When the function is called, an image URL is being returned but the image is not displaying because the image is not being created by the server.
Does anyone have any ideas as to how I can fix this issue?
I am simply printing image_style_url, where "thumbnail" is a name given to the image style that was created in the admin area.
$img_url = $node->field_image[0]['uri'];
print image_style_url("thumbnail", $img_url);
I just had had this problem generating sites/default/files/styles/newsletter_thumbnail/public/Scotland_bankers_2.jpg - it turned out that the file Scotland_bankers_2.jpg didn't exist in the /files/ folder so there was nothing to generate!
The $img_url your passing may be invalid. Check if uri value is accessible.
Do you have multiple images in one field?
I think you should be accessing the data like this:
$node->field_image[$node->language][0]['uri']
I encountered the same error before when my image was deleted.
did u set a style for that image ?
this is how to print the img from a custom template
$style='full_content_width';
$path=$node->my_img_field['und']['0']['uri'];
$style_url = image_style_url($style, $path);
print "<img src=".file_create_url($style_url)." >";
how do I grab images from a node using php? I"m using views_get_view_result to retrieve the array from Views and for the image field I get a serialized string:
a:2:{s:3:"alt";s:20:"south pacific poster";s:5:"title";s:0:"";}
it contains no reference as to where the image is located or the name of the image. In Views the image displays properly in the preview area.
Thanks
ah! Views has an option for URL to File
Its hard to tell exactly what you are doing, but you can get the filepath from the fid with something like:
<?php
$r = db_result(db_query('select filepath from files where fid=%d',$fid));