I am using jquery file upload with the Codeignitor . I copied the working code and place it in Codeignitor . When i try to upload the file i keep getting this meessage
Error Not Found
I check on internet and its says path issue where as i can access the file with that path
in codeignitor my form has this value for action
<form id="fileupload" action="<?php echo base_url()?>public/assets/jquery-file-upload/server/php/index.php" method="POST" enctype="multipart/form-data">
and in firebug i can see the full path in the action attribute .
Related
I'm faced a problem since yesterday in my laravel projet. I have a input file and the file is uploaded in the forder storage/app/public/uploads.
Now when i want to show the file I have this message: "Access forbidden! You don't have permission to access the requested directory. There is either no index document or the directory is read-protected."
<td><a class="" style="text-decoration: underline;" href="{{ asset('storage/app/public') }}/uploads/{{ $row->file }}" target="_blank" style="color:black;font-size:120%">{{ $row->name }}</a></td>
How can I solve this problem.
You need to make the file publicly available.
https://laravel.com/docs/8.x/filesystem#the-public-disk
Run the artisan command php artisan storage:link
This will create a symlink from public/storage to storage/app/public
You can then use the Laravel helper to serve the file
https://laravel.com/docs/8.x/helpers#method-storage-path
storage_path('app/public/uploads/' . $row->file)
I'm trying to view a file that I have uploaded in a view but it shows 404 Not Found. It works fine in local but when I deploy it on heroku this error occurs. I tried php artisan storage:link but it is not working as well. This is the storage directory for the file:
storage/app/public/final_report/2_1_1_1613557659_Ruby Essay.pdf
My Controller:
//get the path for the current Peer Marks final report
$peer_final_report_path = $peer_assignment->final_report['path'];
$peer_final_report_path = "/storage/".$peer_final_report_path;
which the $peer_final_report_path will be /storage/final_report/2_1_1_1613557659_Ruby Essay.pdf
My View:
<!--Display peer marks final report using iframe-->
<div class="card-body" style="float:left;margin-top; 200px;">
<iframe id="pdf-document"
src="{{$peer_final_report_path}}" width="580px" height="800px" >
This browser does not support PDFs. Please download the PDF to view it: Download PDF
</iframe>
</div>
All help will be much appreciated.
Just try something like this.
Storage::url($yourfilepath);
When we do something like this:
Storage::disk('local')->put('file.txt', 'Contents');
How do you make a link to that file in a view? Something like this:
Download File
there are so many things in documentation and yet not even one example how to create a link to that file
Try this command on your terminal : php artisan storage:link, then laravel storage become public access.
Download File
UPDATE:
According to laravel docs, You can get the URL to the file like this:
use Illuminate\Support\Facades\Storage;
$url = Storage::url('file1.jpg');
Remember, if you are using the local driver, all files that should be
publicly accessible should be placed in the storage/app/public
directory. Furthermore, you should create a symbolic link at
public/storage which points to the storage/app/public directory.
Hope this helps!
Scenario--(working from a fresh Laravel 5.6 project install for reference):
With the existing default paths being /public and /storage/app/public and you want to physically store your logo.png image in the /storage folder and render it on your Welcome page, the process would go something like this:
In your terminal, navigate to your Laravel project folder.
Run command php artisan storage:link
Now create the folder /images in your /storage/app/public folder which gives you /storage/app/public/images.
Look in your /public folder and you will see the (shortcut) subfolders /storage/images
Copy a test image named logo.png into the /storage/app/public/images folder.
In your project's welcome.blade.php under /resources/views paste the
following code over the existing code:
<div class="content">
<div class="title m-b-md">
Laravel
<div>
<a href="/">
<img src="{{url('/storage/images/logo.png')}}" alt="Logo Image"/>
</a>
</div>
</div>
</div>
Save and open your project in your browser and you should see the logo image.
Having said all of that, later on you need a pdf folder to store uploaded pdf
files. Easy, just create a new folder in /storage/app/public called /pdf and
automatically the shortcut will appear in the /public folder. It is a once and "for all" solution.
In my Laravel project I'm trying to load an image into my view using blade but it displays as a broken link. I inspect it with firebug and the src is pointing to the image but nothing is displaying.
My image is located in my project's public/images/users/3/profilePictures/
Here is my <img> in the view.blade.php
<img class="com-profile-picture" src="images/users/{{ $follower->id }}/profilePictures/50thumb-{{ $follower->profilePicture->url }}" alt="{{ $follower->first_name }} {{ $follower->last_name }} Profile" width="50" height="50">
However I get this when I load the page:
When I inspect the image with firebug I see this:
That is the correct src and the image does exist in my public/images/users/3/profilePictures/ directory
Anyone know why this is happening?
This may be caused you are in a route which does not represent the base URL. You should generate the URL for your assets relative to the public/ folder. Use URL::asset('path/to/asset') to generate the URL.
{{ URL::asset("images/users/{$follower->id}/profilePictures/50thumb-{$follower->profilePicture->url}") }}
Or as #lukasgeiter mentioned you can simply use asset('path/to/asset') helper.
You can try with the
php artisan storage:link
else you can use this
A simple fix for the issue (linked broken error)
in .env file
APP_URL=http://localhost
this replace with the
APP_URL=http://localhost:8000
then the issue will be fixed.
delete already generated symlink and then run this command
php artisan storage:link
if you are using laravel, consider excluding public folder or any folder where your public files are store in .htacccess from folders that laravel control.
Do it like this in .htaccess
# Exclude directory from rewriting RewriteRule ^(public/) - [L]
Storage location before (Not Working) :
<img src="{{asset('storage/app/public/media/productImages/'.$list->image)}}" alt="" srcset="">
Working storage location :
<img src="{{asset('storage/media/productImages/'.$list->image)}}" alt="" srcset="">
Else try :
Deleting all the linked/shortcut folders created in public folder
Then recreating the link by running :
php artisan storage:link
I have a problem with the target tag of anchors. The anchor specification is:
<?php echo anchor(site_url('areaResponsable/perfil'), "Aquí", array('target' => '_self')); ?>
But, when I upload the project to the server, the links open in a new tab. And FireBug shows the next anchor:
<a class="external_link" target="_blank"
href="http://apps.manantiales.edu.ar/index.php/areaResponsable/perfil">Aquí</a>
Whats wrong, any ideas?
I checked your website http://apps.manantiales.edu.ar/index.php and did a wget for all your js files. I found that a library named gebo_common.js is setting any link with 'http' in it as an external link. Which using site_url will use http.
The file http://apps.manantiales.edu.ar/js/gebo_common.js on your server has jQuery code to set the class 'external_link' to absolute urls.
So do this:
echo anchor('areaResponsable/perfil', "Aquí")