Uploading files from one site to another - asp.net

I have 2 asp.net sites (site1 and site2). site1 have a directory inside in called images. In images directory there are images. I need to upload files using site2 aspx page, but need to upload them to images folder of site1. how can I do that?

If you cannot write directly to the folder or the sites are on different servers then best option is to upload the file to site 1 then use WebClient object to upload file to site 2. More details on how to use web-request to upload and download files can be found here.

Related

how to serve image from custom folder?

I have this site deployed in IIS:
Now what I am trying to do is to show an image under the App_Data folder, the path being "App_Data/uploads/abc.jpg"
In code I have this:
<img src="~/App_Data/uploads/abc.jpg" alt="img">
and then I get a 404 error suggesting resource not found. When I inspected the sources tab in chrome dev tools I have this :
This means the App_Data folder was not even served in the request in the first place now how could I serve the folder, the folder contains images of my products. Also if someone could suggest if this is a good approach since there would be thousands of product images and I don't necessarily need to serve the entire folder for each request there has to be a better way, Thanks
In the iis request filtering, the app_data folder cannot be accessed, so I suggest creating a new folder and uploading image to this folder.

Place media attachment in other directory (Wordpress)

My client is using an old media attachment URL for their email signature logotype. This image has now been removed and I would like to upload the same image again and place it in the same directory as before, recreating the URL.
However, when I upload a new media file to Wordpress, the file automatically is placed in a directory that corresponds with the current date: .../wp-content/uploads/2018/09. I would like to place it in the directories .../wp-content/uploads/2015/09/.
Is it safe to manually create these folders and upload the file via FTP or would the manually added files be overwritten or removed in some way upon updating Wordpress? If so, is there some other way to change the date of a media attachment and automatically create the correct folders depending on the date I change it to?
If there isn't a folder "2015" in your /wp-content/uploads you can add this folder through your FTP program, same goes for the monthly folder. If the folder for the year and/or month are already there you can just upload the image to the desired folder by using your FTP program.

Bluimp Backload folder reference issue with virtual directories

I am working on a solution which has two projects in it. One is a virtual app which works in another. The first application is the panel and the second is the website. First application can be accessed with "localhost:10001/panel" and the second with "localhost:10001". You see, I created a virtual path for the first app to work under the second one in Visual Studio and they work great that way.
The problem I am having now is about the file uplaod system, "Blueimp's jQuery-File-Upload" plugin and as backend using "Backload". I must say that these work great on a standalone project. That's why I decided to continue the project using these.
But when it comes to a setup which I explained below, I cannot access the files I upload. I installed fileupload system in the panel project, which is accessed as "localhost:10001/panel" so when I leave the default web.config configuration for backload (default is "~/files"), all files are uploaded to the "localhost:10001/panel/files" path. And after the upload when I refresh the page, all uploaded file links are referencing "localhost:10001/files/" without the "panel" folder.
In BackLoad web.config notes how to change and use root upload folders are explained like that
filesRoot: // Root upload folder. If the value starts with '~/' (e.g. ~/files) the path is relative to the web root, otherwise set an absolute local path (e.g. d:/files) [Default: "~/Files"].
I understand that having "~/" at the beggining of a folder reference shows the project's root. But I can't figure out how to reference the upload folder, instead of the default "~/files", to upload and access all files from the second project's root. When I need to reference folder between these two projects I simple use "../", or "/" to access the second project's (site) root. But doing that in "filesRoot" attribute of BackLoad config settings, all file references are starting "///file....." and shows a local path in the computer.
I simply want to upload and access the files from the "localhost:10001/files" location when I upload files from the panel. Now, I cannot even use the "localhost:10001/panel/files" path because files are uploaded to "panel/files" folder, but are accessed from "files" folder with default settings.
BTW: I am using BackLoad's WebForms Example on this project, and this is a Web Forms project.
I ended up using Files folder as a temp folder. At the time of submit, I move the file which is uploaded in Files folder, to the folder of my need. And the problem is solved.
Thanks anyway...

Save website uploads in a subdomain

Currently whenever a user uploads a file through our website, it gets put in a folder such as:
www.domain.com/Uploads/Docs/filename.doc
However, I'd like to move this to a subdomain such as:
uploads.domain.com/Docs/filename.doc
This is mainly because I'd like to keep the files uploaded by the user, totally seperate from the web app.
However, currently I use an ASP.NET FileUpload control to upload the files, by doing something like:
myFileUpload.SaveAs(Server.MapPath("/Uploads/Docs/filename.doc"))
How would I change this line of code to be able to upload to the subdomain easily?
Cheers.
If both domains are on the same server, simply point the site for the subdomain to the /Uploads/Docs directory as the base directory.
You can then restrict this directory from your www domain.
Different sites can share the filesystem and this may be a good solution for your problem, without changing any code.

Main Site With 000WebHost

I am trying to create a site with xhtml I have it done I just need to figure out how to upload it
I am using 000webhost as my web hoster but whenever I go on my main page it says
index of/
then it says all of my sites
I want to go directly to m main site
how do I do that?
You should go to:
Members area,
Login,
Select in Action GoTo Cpanel and then:
You should configure your FTP servers, upload an index.html or index.php file and put your main information there.
EDIT:
You should upload everything to your public_html folder always, you should see a file that should say do_not_upload_here before that folder.
Public html is what what it sounds like. The html container folder that contains what will be visible*. (*VERY rough explanation)
You can use their file manager or an FTP client for this pourpose.
BTW beware of the affiliate programe fo 000webhost, check it out, total hoax (the web hosting is very good for being free).
I´ll gladly expand if you have any doubts.
Here is a good FTP basic tutorial:
http://www.youtube.com/watch?v=I85sldEvLuY&feature=related
Do you have an index.html file in your root directory with your host? Without one of those (or another similar index file), you will just see a directory listing of your site.

Resources