Im trying to upload file to a Symfony app, then retrieve the file from the ParamFetcher of FosRestBundle, finally create a SonataMedia object with the uploaded file.
Im stuck on how to upload the file. The entire application has been developed using Postmans POST, GET, DELETE, etc functions for testing right until now.
If already tested as shown in the picture, simply doing a POST with de param file having the image file selected. ParamFetcher is not detecting the param and returns error message saying file is null.
Related
How can I add a static data file to my web project? It doesn't work in debug mode with IIS Express, and I don't have a web site to deploy to yet.
Details
I have a data file that I want to expose on my web site. I have added that file to my ASP.NET project. When I run the project and attempt to view the file, I get a 404. In other words, I debug the project and type the file url into the browser. That url looks like 'https://localhost:44378/Data/widgetConfigMap.json'.
Rationale:
I need the data file to feed a javascript method. That method has an input parameter for a url with data, i.e. my file. The API in question is Bing Maps. The method name is 'createFromConfig'.
Unsatisfactory Alternative
I can generate the file 'on-the-fly' (via a method in my controller), but that method is slow. Slow enough that it timed-out once.
What I have tried
I tried updating the file properties. Initially, the file Build Action was 'Content', I changed that to 'Page', then to 'Resource' → neither worked. The other property choices look wrong.
Summary
I feel like there should be some way to configure my project, or IIS Express to serve-up the data file, but I can't find it.
It sounds like you just add the json file to your project folder instead of importing the json item into your project.
You can access json file directly when you have imported either new json item or existing json file to your /Data folder under your application.
Besides, please ensure you have let your route ignore the URL so static file handler will handle this.
Of course, you can try to publish it to local IIS not IIS express. Then import the data file and it shouldn't be limited.
I'm working on an API on Symfony 4. When I call a route I get this error :
(1/1) ErrorException
Warning: rename(/home/api/var/cache/dev/doctrine/orm/Proxies/__CG__AppEntityClientDonneurOrdre.php.5cd152498b5116.72752587,/home/api/var/cache/dev/doctrine/orm/Proxies/__CG__AppEntityClientDonneurOrdre.php): No such file or directory"
The two files are in the folder. I don't know what to do?.
It should show my object formatted in JSON but nothing is shown except this error. There is this thing too: When I call a smaller object, that does not have any joints, it shows properly.
Could that be a problem with JMS Serializer?
I'm trying to insert images in my Excel using the PHPExcel_Worksheet_Drawing of PHPExcel (in this Symfony Bundle) but I get this message all the time:
File http://benefest.local/uploads/persons/image/58af244d3f58c_16143190_10210682923503464_8658615512523719175_n.jpg not found!
Here is my code:
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setPath($path);
$objDrawing->setWidth(30);
$objDrawing->setCoordinates('A1');
$objDrawing->setWorksheet($phpExcelObject->getActiveSheet());
My images are uploaded by VichUploaderBundle, and I'm generating the absolute path through a function. which returns me http://benefest.local/uploads/persons/image/58af244d3f58c_16143190_10210682923503464_8658615512523719175_n.jpg
In a browser, this image is displayed!
Any clue?
Answer is based on my comments to this question.
There is a difference between URI and file path:
URI - used in browser, or being more general in HTTP protocol to get access to some resource via web-server
File path - a link to some file within filesystem on your server/computer/etc.
Your function returns a URI string (http://benefest.local/uploads/persons/image/58af244d3f58c_16143190_10210682923503464_8658615512523719175_n.jpg), which can be used to access the image via a web server.
But PHPExcel_Worksheet_Drawing as well as other libraries use PHP's filesystem functions to get access to some file locally. So you need to get a local file path, instead of URI (in you case it is ./uploads/persons/image/58af244d3f58c_16143190_10210682923503464_8658615512523719175_n.jpg).
please show example of POST request path for upload file to AlfrescoCloud storage.
I have been trying to upload using example from tutorial
http://ecmarchitect.com/images/articles/cmis/cmis-article.pdf
but getting bad XML format error response.
can any one, please bring clean example of Atom Entry XML package.
I'm writing a custom Drupal module for a mobile service. That module acts like a web form, but I'm having a problem when uploading a file. All values are inserted into the database successfully except for the file.
I think the function "_webform_client_form_submit_process" is not calling "_webform_submit_file". You can try following solution
1. Try using updating your webform module with the latest release.
2. Try removing your file upload field from fieldset, if its in any.
3. Check the temp and destination directory permission.
I've almost went over the code of the webform module and I solved it now, you have to use file_save and get the $file->fid and pass it to the data object of the submissions object, then call webform_submission_insert and get the $sid and pass it to file_usage_add, this got my module working