Click here to Skip to main content
15,890,043 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
I am making a WPF app that would upload file to a site and capture output to display on the app window. But i am not able to figure out a good way to find link behind the upload button of the site to upload the file to.
For example, i cannot just upload to xyz.com rather i need the link behind the upload button of the site that would tell where the file is uploaded which could be like xyz.com\upload.
I don't know if there a better way to do it without requiring the link.

I found the upload link for SVG to Vector Drawable Converter – Convert SVG images to Android VectorDrawable XML resource files online[^] by Right click > Inspect and then looking at the code behind, the link i found is in the code below.

I need the link for Android SVG to VectorDrawable[^] or a better way to accomplish the task without needing that link.

What I have tried:

C#
String uriString = "http://193.124.64.166/api/svg2vd/v1";

// Create a new WebClient instance.
WebClient myWebClient = new WebClient();

//Filepath contains the path of the .svg file on my local machine
string fileName = FilePath;

// Upload the file to the URI.
var responseArray = myWebClient.UploadFile(uriString, "POST", fileName);

// Decode and display the response.
// ProcessData is my method that formats the data returned by the WebClient
string[] results =     VectorDataProcess.ProcessData(System.Text.Encoding.ASCII.GetString(responseArray));
Posted
Updated 16-Mar-17 14:30pm
v4
Comments
Richard MacCutchan 16-Mar-17 10:23am    
This will vary from site to site, so you need to look at the website's source to see where it is.
Member 13063329 16-Mar-17 11:23am    
I tried a lot and couldn't find it for the second site link i mentioned in the question. If you could please have a look and give any suggestion i would be very thankful.
Richard MacCutchan 16-Mar-17 11:25am    
The second one does not have an upload button, it uses drag and drop. However you will only find the answer by inspecting the page source.
Member 13063329 16-Mar-17 11:39am    
When you click on the drag and drop area it opens up the browse window. I have been inspecting the page source since many hours now, no luck. Another set of eyes might help.
Richard MacCutchan 16-Mar-17 12:31pm    
In which case it is probably doing that to protect itself from bots.

1 solution

Page scraping is a frowned up method of working with websites. If you must do it this way, in a small capacity, it may go unnoticed.

To see what is happening with any HTTP traffic, and identify what is happening, you need a HTTP sniffer like: Fiddler - free web debugging proxy[^]

Once you have it installed and configured, use the website like you usually would manually and do the upload. Now click on the packet on the left, and look at the request on the right and you will see exactly what is required.
 
Share this answer
 
v2
Comments
Member 13063329 17-Mar-17 15:01pm    
I am very new to this but this is what i observed. A bunch of packages were listed on the left then i went to website. Then when i uploaded i didnnt see any changes in the packages and neither any new packages were added, then i tried the other site whose link i already had and for that as i uploaded, few new package appeared on the left and one of them had that link thats shown in my code example above. So i am not sure how to find the behavior or whats required by the site if no visible change occurs on uploading file.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900