douyujun0152 2013-08-31 23:39
浏览 36

使用php脚本将图像存储在服务器上的特定文件夹中

In my application I'm saving an image and transferring to a server through the use of a php script whose sole job is to pass this image to the server which saves it in the root of the server.

The code I have for my upload is as follows:

   NameValueCollection nvc = new NameValueCollection();
   nvc.Add("id", "TTR");
   nvc.Add("btn-submit-photo", "Upload");
   UploadToServer.HttpUploadFile(Settings.Default.ServerAddress , sfd.FileName.ToString(), "file", "image/jpeg", nvc);

Settings.Default.ServerAddress holds the location of my upload php script which the following:

http://server.foo.com/images/upload.php

I have another php script that returns a string of all the file and folders held on my server that is returned and displayed in a text box.

I'm calling this like so:

        using (var client = new WebClient())
        {
             result = client.DownloadString("http://server.foo.com/images/getDirectoryList.php");
        }

What I need to do is have a way so that I can choose the location of where the my image is stored. My feeling is telling that I need to do is have a way so that when a user selects anything with .folder, the old string list disappears and the images and files is stored within that folder.

I believe the call I need to make is something like this:

http://server.foo.com/images/getDirectoyList.php?dir=test_folder

But I'm stuck on trying to implement what I want. For one, the list I get back is all highlight and say I get something like

Image 1

Image 2

Test_folder.folder

I have no way of being able to simply click on Image 2 and have it highlight the whole thing. Instead is simply places the cursor where I clicked. Likewise I have no idea of how I would pass this information over to the my upload code so that my chosen directory is used to store the image as opposed to the root.

Has anyone ever attempted something like this before? Do you have any links or advice that could help me achieve what it is I want to achieve? Additionally, but not important, would I be able to ever create a new directory / folder on my server through my C# winform application without having to touch either the php scripts or the server itself?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 公交车和无人机协同运输
    • ¥15 stm32代码移植没反应
    • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
    • ¥100 连续两帧图像高速减法
    • ¥15 如何绘制动力学系统的相图
    • ¥15 对接wps接口实现获取元数据
    • ¥20 给自己本科IT专业毕业的妹m找个实习工作
    • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
    • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
    • ¥50 mac mini外接显示器 画质字体模糊