Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8024103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:45:50+00:00 2026-06-04T22:45:50+00:00

I am trying to upload an archive file (a Zip archive if that matters)

  • 0

I am trying to upload an archive file (a Zip archive if that matters) to an existing API at an external site and while I can get the webclient to connect and get a token to the site the upload never seems to work, I continually get a 404 error. The problem may be on their side, but I seem to be the only one who has posted about it on their site, yet I wonder if I am using the UploadFile correctly, or if there is a way to capture the response from the command, which I’d like to know if only to improve my PowerShell coding.

What I am running is the following:

# Variables I want to use
$appArchive = "\\networkpath\Releases\CodeReleasePackage.zip"
$localArchive = "c:\temp\CodeReleasePackage.zip"
[string]$appUrl = "https://site.com/api/v1/apps/(id)/"
[string]$tokenUrl = "https://site.com/token"
[string]$uploadUrl = "https://site.com/api/v1/apps/(id)/?auth_token=$mytoken"
# $appCred = Get-Credential
$username = "email@address"
$password = "password"
# Create the web client
"Creating the client.`n"
$pgup = new-object System.Net.WebClient
$pgup.Credentials = New-Object net.NetworkCredential($username,$password)
"Going to the token page"
$pgToken = $pgup.UploadString($tokenUrl,"")
$mytoken = $pgToken -replace '{|}|"|:|token',''
"Now trying to upload the latest file with my token: $mytoken"
$pgup.UploadFile($uploadUrl,$appArchive)

I get the token which is something like {“token”,”hkjuihgkjhiuhhlkhuhk”} and not really knowing if there is a better way to handle the resulting token I did the replace to get rid of everything but the token string. Adding it to the URL is supposed to work but I just get 404 errors accorinding to Fiddler.

So I’d like to be able to capture the response from the site when I run $pgup.UploadFile() but when I do it seems like nothing is coming back, is there a particular way to capture that? I couldn’t find a clear example and when I do something like $response = $pgup.UploadFile() I have nothing in $response. Anything that is useful for diagnosing webclient errors would be great, I’d like to learn more about this since it seems pretty useful

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:45:51+00:00Added an answer on June 4, 2026 at 10:45 pm

    It looks like I cannot access the site with PowerShell as the driver, for some reason I can never get the upload to work but I can read the pages on the site and actually get responses for my account. It may be their API doesn’t like the way PowerShell is running the connection, although I have never been able to confirm anything from PhoneGap since they have not yet responded to my issues on this yet.

    Edited: 6/14/12
    The whole reason this was failing was due to the Apache implementation on their side not accepting the HTTP 1.1 request the way WebClient sends it. If I can get back to HTTP 1.0 then they say I should be able to complete this. Or I can wait for the OAUTH 2.0 implementation and just go from there.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to upload file to an sharepoint online server using webclient. Up
I am trying to upload a binary of an App so that I can
I trying to upload a zip file. In my project i am using DWR
I'm trying to upload images to a php file, everything works, but sometimes when
So I'm trying to upload a document to a sharepoint site using a Java
I'm trying to upload a file .txt in my web space, but then the
I'm trying to upload an image file from an android device to my drupal
I am trying to upload file with like this: NSMutableDictionary * lParameters = [NSMutableDictionary
I'm trying to upload file to amazon s3 and apparently I have to write
Iam trying to upload the video but when file uploads the following response displays

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.