This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Downloading a file from serial flash or SD card

Other Parts Discussed in Thread: CC3200

I am attempting to download a file that is stored on the serial flash of CC3200 using the below code on the webpage.

client.println(" <a href=myfile.csv target=_blank>DOWNLOAD</a>");

I get a DOWNLOAD button But when i click on it, I dont see the file getting downloaded.
Instead the page refreshes with IP_address_of_Launchpad/myfile.csv
Basically i want to just let any user to download the file thats stored.

Also in the similar way,how to download a file stored in SD card? 

Any help?

  • Hi,

    I'm not exactly sure what is it that you are trying to do. You want to download a file from the SFLASH to where? basically, we support GET/POST tokens which can be embedded in the HTML pages. You can read all about it on the Programmer's guide. These tokens are passed to the host (as the device does not know what to do with them) and in return the host should do something. For example, you can use a post token to turn a LED on/off. These tokens are limited in size.

    Regards,

    Shlomi

  • hello Shlomi,

    The launchpad is made a webserver and It continuously reads some sensor data and stores it to the file- 'myfile.csv' in serial flash.

    The launchpad is connected to a router & obtains an ip_adress. When any user who is in that network, enters this ip_address of the launchpad on their device browser, I want to give a link to DOWNLOAD the entire file i.e., 'myfile.csv'.

    hope I was clear.

    Thanks in advance :)
  • Hi,

    The use case is clear now.

    Basically, the internal HTTP server cannot access any file on the file system. However, in your case what you can do is name the file with /www/ prefix. In this case, the HTTP server would just send you back the file to the browser (just as if you typed from the browser the full path).

    Additionally, csv suffix is not a supported file type but .txt is supported so try using it instead.

    Regards,

    Shlomi

  • Hi,

    The /www/ prefix didn't help me.

    What is the other option I have to download any such file?

    Will it be possible for the internal http server to access file from SD card?? If yes, then is there any prefix I need to add before the file name?

    Regards,

    Arun

  • Arun,

    The /www/ prefix should work if you use SimpleLink file system which is implemented on the serial flash (not SD card).

    SDK also has SD host FATFS example but this FS is not attached to the internal web server.

    Is it possible for you to place the file on the serial flash instead?

    Shlomi

  • Hi,

    Did the above post answer your query? please verify the answer.

    Shlomi

  • Hi,

    I am closing the thread, if issue still exist please open a new thread and add a link to this one for reference.

    Shlomi

  • Shlomi,
    great solution!!!
    thanks for the suggestion

    Davide