Page 1 of 1

Displaying uploaded file form another URL

Posted: Thu Dec 14, 2023 7:20 am
by aspsteve

I have two projects with a common databsae but but two separate URLS for different user groups

My Server Directory Structure is as below

C:\inetpub\wwwroot\app\domain1

C:\inetpub\wwwroot\app\domain2

I want all uploaded files from domain1 and domain2 to be saved to the same upload folder C:\inetpub\wwwroot\app\domain1\uploads\files

I have set up the File Upload Folder on project 1 on domain1.com as

uploads/files/

While I set the the File Upload Folder on project 2 as domain2.com as

../../domain1/uploads/files/

When I try to access the files uploaded from dmoain 2 from Domain 1 iget a blank screen with the this long link

http://domain1.com/api/jupload?id=x_AttachementUpload&table=InvoiceReceiptStaging&x_AttachementUpload=FileUploadTesting_1.pdf&download=1&__RequestVerificationToken=CfDJ8KainWds_NVPqI8gOulSBrVM6Ag_X47rv6H29DphtKsC6aRNdqJDpr3M1TTuWXuyvEh83IndVjUD6s3uzovTp0b7wfOBmUv8WffDJ5nCvsFC8NPZcxnVPPW32sHxOlnae6-fKsGXs3FNCZ2p_gWLBFB3LdXXn9354EHipRcXPqKxZmjmrjRBts6yg3D_TEtPbw

How can I fix this?


Re: Displaying uploaded file form another URL

Posted: Thu Dec 14, 2023 9:43 am
by MichaelG

aspsteve wrote:

My Server Directory Structure is as below
C:\inetpub\wwwroot\app\domain1
C:\inetpub\wwwroot\app\domain2
I have set up the File Upload Folder on project 1 on domain1.com as
uploads/files/

That means your real upload path is C:\inetpub\wwwroot\app\domain1\wwwroot\uploads\files\

aspsteve wrote:

While I set the the File Upload Folder on project 2 as domain2.com as
../../domain1/uploads/files/

Double check if the above path is correct.


Re: Displaying uploaded file form another URL

Posted: Sat Dec 16, 2023 12:11 am
by aspsteve

Thank you the above filepath worked.


Re: Displaying uploaded file form another URL

Posted: Sat Dec 16, 2023 1:22 am
by darkdragon

You could also make use of symbolic links for each "upload" folder, pointing to another drive/disk or even an UNC path (network share)
See the command mklink /? in command prompt.

In this way you can keep uploaded data completely safe.
E.g., deleting the uploads folder, will delete the symbolic link, only.