Send file to a remote server

how do I send a file to a remote server?
I attached my code so you can see what is missing.
the purpose of it is to send a server all the files in a directory + the name of directory + how many files there are
URL url=null;
                try {
     url= new URL("www.<server's address>");
                 }catch (MalformedURLException e) {
                  try {
      // Construct data
        File[] picFiles= path.listFiles(new pictureFileFilter());
        int numOfFiles= picFiles.length;
        String setName= path.getName();
        String data= ("setName= " + setName);
        data += ("&" + "numOfFiles= " + numOfFiles);
       String[] allFiles= new String[numOfFiles];
       for (int i=0; i<numOfFiles; i++) {
             FileInputStream FIS= new FileInputStream(path);
          //WHAT TO DO HERE?!?!?
     data += ("&"+"allFiles="+allFiles);          
        // Send data
                   URLConnection conn = url.openConnection();
                  conn.setDoOutput(true);
                  conn.setDoInput(true);
                  OutputStreamWriter wr = new 
                                             OutputStreamWriterconn.getOutputStream());
                  wr.write(data);
                  wr.flush();
        // Get the response
                    BufferedReader rd = new BufferedReader(new       
                                            InputStreamReader(conn.getInputStream()));
                   String line;
                    while ((line = rd.readLine()) != null) {
                                //what to do with response (this part is OK)
                 new GoodBadMassage(line);
                     wr.close();
     rd.close();
         } catch (Exception e) {
         }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
another thing-
is the line --- conn.setRequestProperty("content-type","binary/data");
replace the need in ---
String data= ("setName= " + setName);
OutputStreamWriter wr = new utputStreamWriter..
wr.write(data);
I'm not sure what does is do (setRequestProperty)
THANKS!!

You start out by trying to use a malformed URL (it doesn't start with a protocol). This suggests to me that you haven't thought about the natural question: what kind of server software is running on that server that will accept files?

Similar Messages

  • How can I publish an ics file to a remote server from my calendar server?

    I am running Lion Server and have Calendar Service up and running. I have an account with a couple of calendars, one of which I'd like to publish to a remote server, as an .ics file.
    From an iCal client it is possible to publish local calendars, but not remote calendars (for which the only option seems to be to 'Share').
    How can I can I publish an ics file to a remote server? Programatically, if necessary.

    I have this working now.
    curl -s --digest -u username:password -o calendar.ics http://hostname:8008/calendars/users/username/calendar/
    generates the .ics file, and a combination of cadaver (from webdav.org) and an expect script upload hourly (via cron) to the remote server:
    set timeout 60
    spawn /usr/local/bin/cadaver
    expect "dav"
    send "open https://remotehost/path/\r"
    expect "Do you wish to accept the certificate? (y/n)"
    send "y\r"
    expect "dav"
    send "put calendar.ics\r"
    expect "dav"
    send "close\r"
    expect "dav"
    send "quit\r"

  • Can SQL Loader load files on a remote server?

    Hello,
    I normally use SQL loader on my PC to load an 8i database located on an NT server in another state. The input file is rather large and takes several hours to load-- even with all the contraints, etc. disabled. I assume this due mostly to all the network hops between my PC and the server. I now have an FTP that can place the input file on our Oracle DB server itself. It seems to make sense that if the files were located on the server, it would load much faster. My question is: is it possible to create a sql loader process to load files located on the remote Oracle server that I can initiate or control from my PC?
    Thanks in advance for any help.
    Jeff

    Windows Terminal Services will allow you to interact with the server where you are loading the data. You could FTP the file to the remote server, start a Terminal Services session, and type or run your parameter file at a command prompt. One thing to be aware of is setting the ORACLE_SID environment variable. When you set ORACLE_SID and try to connect to the database withconnect / as sysdbayou will get the following errorERROR: ORA-12560: TNS:protocol adapter errorbut if you connect withconnect /@<connect_string> as sysdbathe connection works perfect. Don't really know the details on why it does this but just a issue to look out for.

  • How do I copy a file to a remote server using runtime exec - plz Help!

    Hi,
    I am trying to copy a file to a remote server using a runtime exec command as follows:
    Runtime.getRuntime().exec("scp "+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_PATH_JAR)+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_JAR_NAME)+".jar "+" "+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_PATH_TWO_USERNAME)+"@"+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_PATH_TWO_URL)+":"+getProperty(ListNewHandsetDetailsConstant.PROP_OUTPUT_PATH_TWO_JAR));
    Problem is this statement does not execute, as when I try it directly on command line, it requests for a password. Any suggestions on how I can get rid of that? I think I might have to configure my ssh_config file, but when I did some "Googling", I found the configuration settings of a ssh2_config file. I tried those (changing it to Host-based Authentication), but it didn't recognise them. Please help, this is so urgent!
    Regards,
    Simz

    Don't use Runtime.exec (or ProcessBuilder) for this. Check out JSch at JCraft (or some other Java SSH API.

  • Does the local server send the query to remote server?

    I have 2 servers,a local server connect with remote server through database link.If I execute a query at local server but only access tables in remote server,does local server send this query to remote server or all the tables at remote server will send to local server?If local server send this query to remote server,does it can execute another query while it waits the result send from remote server?
    Any help would be appreciated
    Regards

    Yes is executed on remote , and the remote can accept queries as normal see my example below
    SQL> select * from v$database@prod_p;
    Execution Plan
    Plan hash value: 3039639316
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time
    | Inst |
    | 0 | SELECT STATEMENT REMOTE| | 100 | 64400 | 0 (0)| 00:00:0
    1 | |
    | 1 | MERGE JOIN CARTESIAN | | 100 | 64400 | 0 (0)| 00:00:0
    1 | |
    |* 2 | FIXED TABLE FULL | X$KCCDI | 1 | 582 | 0 (0)| 00:00:0
    1 | RPRD |
    | 3 | BUFFER SORT | | 100 | 6200 | 0 (0)| 00:00:0
    1 | |
    | 4 | FIXED TABLE FULL | X$KCCDI2 | 100 | 6200 | 0 (0)| 00:00:0
    1 | RPRD |
    Predicate Information (identified by operation id):
    2 - filter("DI"."INST_ID"=USERENV('INSTANCE'))
    Note
    - fully remote statement

  • Upload File to a remote Server

    Hi all,
    i have a requirement like, i have to upload files to a remote server through SFTP. need help regarding this. i dont know where to start.
    Thanks.

    Do you need to do this from within a program(of your own writing)?
    Just filtering the obvious, but if you can use an existing SFTP program for your needs, do.
    That being said, while Java does excel at automation, I don't know if it goes as far as giving you ready-made SFTP. More likely, you're going to have to either:
    1. Learn the SFTP protocol and implement it yourself using sockets.
    or
    2. Find a ready-made Java package for using SFTP. It's not too unlikely someone somewhere made one for whatever purpose. You'll, of course, be bound by whatever license said someone released said package under.
    Regardless of which of the above you choose, you're going to have to start with Google. Either search for a description of SFTP, or for a Java package for SFTP.

  • Send Files to Mac remotely

    The next time I go on vacation im going to use my camera to take raw image files and would like to send them back to my mac mini from a remote laptop (id like to use linux but could use windows I suppose lol).  Should I get OSX server (wait for mountain lion of course) or some other method?  I know I can just get more storage on dropbox but id rather not have to pay the monthly fee.
    Thanks

    Even if the term "to share" also addresses using belongings of other persons
    I think giving own belonging to others for use by them is mainly addressed by thas term,
    I mean as for the term "to share" its outbound sense comes before its inbound sense.
    Nevertheless if the term "to share" covers both giving as well as receiving the System Preferences,
    the Bluetooth section should cover these two. Otherwise the naming is misleading.
    Currently for sending files through BT to peers works even if the BT sharing is disabled.

  • Sending files from the remote method

    hi,
    I would like to know if we can send a File object, i.e. a file as the return value from the remote method on the server side accessed by the client.
    Actually, i want to make the files stored at the server system accessible to the client system. how to achieve it?

    java.io.File implements java.io.Serializable so the previous answer is formally incorrect. However you need to be aware that that would only send the File object, which is essentially the filename, not its contents. I'm sure that what the poster meant to say.
    You can send the contents as well in a number of ways but you have to write it by hand. There's no easy way out of the box.

  • How to upload a current file to the remote server in Dreamweaver?

    I am trying to transfer an html file from FrontPage to the server via Dreamweaver, but it absolutely refuses to upload. Help!

    Nobody can know anything. You are not providing any system information, what version of DW you use, what the remote server actually is. and since this is a DW question, ask in their forum with the proper information included.
    Mylenium

  • HTML files uploading to remote server, not reflected on website.

    After minimal adjustments to an HTML file, I upload it to the remote server. The local and remote files reflect this in the "modified" line, both mirroring the same exact time. However, when I go to the actual site, the changes don't appear.
    Now, when I update the html file, say cv.html, it also makes the same changes to 2.html. When I click on the link on the website, it appears at 2.html. Somehow cv.html and 2.html are linked to each other. (I guess to keep the overall web address smaller)?
    I just took on this website to manage and I've already hit a million roadblocks trying to get it started on my end, so anyone that can solve this I would be SO grateful!

    Somehow cv.html and 2.html are linked to each other.
    Could be CV is being pulled into a framed parent page called 2.html.  Or maybe your previous web developer used server-side includes to populate page 2 with content from other site files. It's anybody's guess what may be going on until you provide us with more detailed information. A URL is preferred.  Copy & pasted code is a 2nd option but don't use e-mail, it won't come through to the web forum.
    Nancy O.

  • Robohelp 7 App is really slow in deploying files to the remote server - Why?

    Hi,
    I am totally new to RoboHelp. So Please forgive my ignorance!
    The Robohelp we have was developed by somebody who is not with our company anymore. I think he used Robohelp 5 to develop our Policies and Procedures. The files are deployed on one of our remote server. (Do the server have to have Robohelp installed as well?? I checked the server to find if it has Robohelp installed and I could not find it?)
    One of our Analyst has Robohelp on her PC. She used to have Robohelp 5 and now she has Robohelp 7 to deploy the files to the server.
    It was working perfectly fine till she used Robohelp 5. Deploying the files to the server took about 2 hours before and now with Robohelp 7 on her PC, it takes forever and we are unable to deploy the files to the server from RoboHelp application!
    What should I be doing to make it faster? Please let me know. Thanks in advance!!
    Uma

    Hello again
    Well, ummm, how shall I put this? YIKES! The page you linked to is for RoboHelp 9. Now you may be scratching your head at this point and saying waitadoggoneminnute there MR. Man!What gives?
    Here's the deal. Way way back when a little company called eHelp corporation held the reigns, RoboHelp was at version 7. Then version 8 came along but wasn't really called version 8. It was called version 2000 because it was released in the year 2000. Then they published version 9. Then came version 10 and that one was called version 2002. Then version 11 shipped but was called X3. Then version 12 shipped and was called X4 and finally "lucky" version 13 arrived and was called X5. Enter another small company known as Adobe. Adobe saw the 5 and decided to name their next version "6".
    This wouldn't really be much of a problem, EXCEPT, we now see material that is grossly outdated that would seem to apply to today's versions and of course they are wrong!
    So here's where it gets fun. Note that the date of the article you pointed to is October, 2000. Nearly ten years old! I'm guessing that the dialogs you are seeing are a wee bit different than what are on that page.
    So just to be complete:
    When you double-click the WebHelp layout you see the first of several dialogs. It usually looks like this:
    Note the highlighted part. This is the location where WebHelp will generate to as well as the name of the Start Page. Oftentimes folks configure this location to be the location where everyone points to open the WebHelp from the connected PCs. And if this is the case, that is likely the reason the process is so slow.
    The location specified here should always point only to the C drive.
    If you click the Next > button three times you should see the screen below.
    THIS is where you would want to configure the publishing destination.
    So you should have two actions. One action creates the files and the second action Publishes (or copies) the files from the C drive to the server.
    Note that none of the options have been enabled in the dialog above. That's typically the preferred way to work. You only need to enable these options under specific conditions. So if you have this configured but have enabled perhaps the Republish all option, perhaps that would also explain the slow operation.
    Hopefully this helps... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 moments from now - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcererStone Blog
    RoboHelp eBooks

  • Putting files onto the remote server vs. the testing server

    I have a testing server defined in my site that can only be accessed internally within the company. When I preview my pages, it automatically loads them onto the testing server and when I ask opinions about the changes I have made, my co-workers can go to that web address on our internal FTP site.
    But when I want to take those same files and put them onto our live site, I can't figure out how. I also connect to that site through FTP and have defined it in the remote server location. How do I put these files onto our real, live website?
    I've been reading tons of help topics about this, but still can't seem to figure it out

    Hi There:
    It is an easy step by step do that. Here are some really good help for you on the same:
    http://www.youtube.com/watch?v=kJhL1d9D2R4
    http://www.bgsu.edu/downloads/cio/file17760.pdf
    http://help.adobe.com/en_US/Dreamweaver/10.0_Using/WSBE25912D-A9DE-4ba1-9F85-4C692F5C14ADa .html
    And by the way why can't your colleagues see your site internally? if you have a testing server (is it IIS or WAMP?)  ...all you need to give them is something as following so that they can view it..
    http://yourmachinename/index.html
    or
    http://yourmachineIPAddress/index.html
    I believe you all are on the same network at workplace.
    Regards,
    VInay

  • Is it faster to download files from a remote server or file sharing with Back To My Mac?

    I am trying to send somebody a 6GB file using Back To My Mac. I had them set up my Apple ID in iCloud in System Preferences on their Mac and check the box for Back to My Mac. Went into Sharing preferences to check the boxes for File Sharing and Screen Sharing.
    From my Mac I then went to that shared computer in the Finder, copied over my file but it's showing that it will take 27hrs to transfer.
    Is this normal? And if so would setting up a server for remote access be better for transferring such large files?
    Any other mind blowing ideas would be most welcome for remote large file tranfer.
    Jazz
    Message was edited by: ShadowRa
    Message was edited by: ShadowRa

    Download history usually will have the link back to the original source location. Assuming that still exists, it's worth a try. When you right-click (Ctrl+click) an item, the small context menu should let you copy the URL of the original source, which you then can paste into the address bar to fetch it again. If the original download required you to be logged in to the source site, you should log in again first to increase your odds of getting the download.

  • How to execute a batch file on different remote server using TFS Build

    I have a build server and have 2 web servers. I am deploying using TFS Builds. Now, I have a requirement to execute a batch file which is kept on these 2 web servers. i.e. C:\MyBatch\CreateMe.bat
    After my build is successful, I need to execute this batch from the build server.
    Note, I cannot make any shared folder.

    Hi Sameer, 
    Thanks for your post.
    What’s the version of your TFS?
    How do you deploy solution using TFS Build, run MSBuild deploy command or using Release Management?
    That C:\MyBatch\CreateMe.bat file stay on your two web server machines separately? 
    If you want execute this bat file on your two web server machines separately using build process template, you need configure your web server machine as build agent, then add the InvokeProcess activity in build process template to run the bat file on build
    agent machine after build, please refer to Hari’s answer reply in this post:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/b8bcb19f-1296-441c-8356-e701b949445a/tfs-2010-how-to-execute-a-batch-file-after-build?forum=tfsbuild.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Read File using File adapter from remote server

    I need put poll on remote directory for files. Can some one tell where to put the remote connection details?
    Thanks
    KK

    Sorry dumb question!!!! We can use GetFile operation in FTP adapter.....
    Thanks
    KK

Maybe you are looking for