mani786's avatar

Storage Link Not working

Hello, I shifted my project to new domain and now the storage link is not working in laravel while I have also done

rm public/storage
php artisan storage:link   ``

 at start this command workd and file uploads in data base in the required forlder but when I fetch that on site so there is just link in <img> section and just url opens

```  <a :href="props.row.user_type==='user'?userAssest + 'public_html/storage/app/' + props.row.file_name:workerAsset + 'storage/app/' + props.row.file_name" target="_blank">{{props.row.image_original_name>15?props.row.o_name+'...':props.row.original_name}}</a>

site_name/public_html/storage/app/user_incoming_packages/1/uQOpGMI73zVI7coVL8Wo2EgkuHDw7GN4S8XwgGjY.png  ````

pls help me out in this problem
0 likes
4 replies
mani786's avatar

@MohamedTammam can you pls re-write code for me according to my path or I have to use home/.. as universal

kokoshneta's avatar

at start this command workd and file uploads in data base in the required forlder but when I fetch that on site so there is just link in section and just url opens

Sorry, but this is just gibberish. It makes no sense. I realise that English is probably not your first language, but if you want people to understand you, you need to make an effort to write in clear sentences and use punctuation.

:href="props.row.user_type==='user'?userAssest + 'public_html/storage/app/' + props.row.file_name:workerAsset + 'storage/app/' + props.row.file_name"

What is this supposed to produce? It’s hard to say much when we don’t know anything about your setup at all, but at first glance, this appears to be full of problems:

  • What are userAsset (I’m assuming ‘assest’ is a typo?) and workerAsset?
  • Whatever they are, why are they before storage in the URL? They probably shouldn’t be.
  • Why do you have public_html in one of them (but not the other)?
  • Where are the images actually stored?

(Also, for the sake of your colleagues and fellow coders, please use spacing in your code. Code without spacing is illegible.)

I’m going to assume/guess that your structure looks something like this:

|-- public
|	|-- storage (symlink)
|-- storage
|	|-- app
|	|	|-- user_assets
|	|	|	|-- image.png
|	|	|-- worker_assets
|	|	|	|-- image.png

Is that correct?

If it is, your image URLs should look like this:

<a :href="props.row.user_type === 'user' ? '/storage/' userAsset + '/' + props.row.file_name : '/storage/' + workerAsset + '/' + props.row.file_name">

Please or to participate in this conversation.