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

  • Home
  • SEARCH
  • 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 1003481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:59:14+00:00 2026-05-16T07:59:14+00:00

I can’t seem to find a solution to this issue. I’m trying to get

  • 0

I can’t seem to find a solution to this issue. I’m trying to get my Compact Framework application on Windows Mobile 6 to have the ability to move a file on its local filesystem to another system.

Here’s the solutions I’m aware of:

  • FTP – Problem with that is most of
    the APIs are way to expensive to use.

  • HTTP PUT – As far as I have been able to find, I can’t use anonymous PUT with IIS7, and that’s the web server the system is running. (An extreme workaround for this would be to use a different web server to PUT the file, and have that other system transfer it to the IIS system).

  • Windows share – I would need authentication on the shares, and I haven’t seen that a way to pass this authentication through windows mobile.

The last resort would be to require that the devices be cradled to transfer these files, but I’d really like to be able to have these files be transferred wirelessly.

  • 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-05-16T07:59:14+00:00Added an answer on May 16, 2026 at 7:59 am

    I ended up just passing information to a web server via a PHP script.

    The options provided above just didn’t work out for my situation.

    Here’s the gist of it. I’ve got some code in there with progress bars and various checks and handlers unrelated to simply sending a file, but I’m sure you can pick through it. I’ve removed my authentication code from both the C# and the PHP, but it shouldn’t be too hard to roll your own, if necessary.

    in C#:

    /*
     * Here's the short+sweet about how I'm doing this
     * 1) Copy the file from mobile device to web server by querying PHP script with paramaters for each line
     * 2) PHP script checks 1) If we got the whole data file 2) If this is a duplicate data file
     * 3) If it is a duplicate, or we didn't get the whole thing, it goes away. The mobile 
     *    device will hang on to it's data file in the first case (if it's duplicate it deletes it)
     *    to be tried again later
     * 4) The server will then process the data files using a scheduled task/cron job at an appropriate time
     */
    private void process_attempts()
    {   
    
        Uri CheckUrl = new Uri("http://path/to/php/script?action=check");
        WebRequest checkReq = WebRequest.Create(CheckUrl);
        try
        {
            WebResponse CheckResp = checkReq.GetResponse();
            CheckResp.Close();
        }
        catch
        {
            MessageBox.Show("Error! Connection not available. Please make sure you are online.");
            this.Invoke(new Close(closeme));
        }
        StreamReader dataReader = File.OpenText(datafile);
        String line = null;
        line = dataReader.ReadLine();
        while (line != null)
        {
            Uri Url = new Uri("http://path/to/php/script?action=process&line=" + line);
            WebRequest WebReq = WebRequest.Create(Url);
            try
            {
              WebResponse Resp = WebReq.GetResponse();
              Resp.Close();
            }
            catch
            {
                MessageBox.Show("Error! Connection not available. Please make sure you are online.");
                this.Invoke(new Close(closeme));
                return;
            }
            try
            {
                process_bar.Invoke(new SetInt(SetBarValue), new object[] { processed });
            }
            catch { }
            process_num.Invoke(new SetString(SetNumValue), new object[] { processed + "/" + attempts });
            processed++;
            line = dataReader.ReadLine();
        }
        dataReader.Close();
        Uri Url2 = new Uri("http://path/to/php/script?action=finalize&lines=" + attempts);
        Boolean finalized = false;
        WebRequest WebReq2 = WebRequest.Create(Url2);
        try
        {
            WebResponse Resp = WebReq2.GetResponse();
            Resp.Close();
            finalized = true;
        }
        catch
        {
            MessageBox.Show("Error! Connection not available. Please make sure you are online.");
            this.Invoke(new Close(closeme));
            finalized = false;
        }
        MessageBox.Show("Done!");
        this.Invoke(new Close(closeme));
    }
    

    In PHP (thoroughly commented for your benefit!):

    <?php
    
    //Get the GET'd values from the C#
    
    //The current line being processed
    $line = $_GET['line'];
    //Which action we are doing
    $action = $_GET['action'];
    //# of lines in the source file
    $totalLines = $_GET['lines'];
    
    //If we are processing the line, open the data file, and append this new line and a newline.
    if($action == "process"){
        $dataFile = "tempdata/SOME_KIND_OF_UNIQUE_FILENAME.dat";
        //open the file
        $fh = fopen($dataFile, 'a');
        //Write the line, and a newline to the file
        fwrite($fh, $line."\r\n");
        //Close the file
        fclose($fh);
        //Exit the script
        exit();
    }
    
    //If we are done processing the original file from the C# application, make sure the number of lines in the new file matches that in the 
    //file we are transferring. An expansion of this could be to compare some kind of hash function value of both files...
    if($action == "finalize"){
        $dataFile = "tempdata/SOME_KIND_OF_UNIQUE_FILENAME.dat";
        //Count the number of lines in the new file
        $lines = count(file($dataFile));
        //If the new file and the old file have the same number of lines...
        if($lines == $totalLines){
            //File has the matching number of lines, good enough for me over TCP.
                //We should move or rename this file.
        }else{
            //File does NOT have the same number of lines as the source file.
        }
        exit();
    }
    
    if($action == "check"){
        //If a file with this unique file name already exists, delete it.
        $dataFile = "tempdata/SOME_KIND_OF_UNIQUE_FILENAME.dat";
        if(file_exists($dataFile)){
            unlink($dataFile);
        }
    }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.