douzhuo3233 2019-03-29 14:53
浏览 58

如何将字符串xml转换为实际的xml文件并传递给$ _FILES

I am using a video CMS that has bulk files upload function. The way it works is: - You upload a .xml file with the current content:

<?xml version="1.0" encoding="UTF-8"?>
<meta>
    <video>
        <filename>name1.mp4</filename>
    </video>
    <video>
        <filename>name2.mp4</filename>
    </video>
</meta>
  • It sends an ajax request to "ajax/upload"
  • Then it returns some data (tmp_name and etc)

What I want to do is to generate a xml file with two filename values passed. (Eg. Have two input fields and with: name1.mp4 and name2.mp4, then generate a xml with this data by clicking a button or something else) After that what I really want to do is simulate like the file was uploaded by the user, because I need to access this data inside my ajax request:

$_FILES['upload']['size']
$_FILES['upload']['tmp_name']
$_FILES['upload']['name']

Current file upload input:

<input class="uploader" type="file" name="upload" data-url="../ajax/upload/" data-text="Browse" data-limit="102000000" data-type="library" data-prepopulate="null">
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 模型在y分布之外的数据上预测能力不好如何解决
    • ¥15 processing提取音乐节奏
    • ¥15 python进程启动打包问题
    • ¥15 gg加速器加速游戏时,提示不是x86架构
    • ¥15 python按要求编写程序
    • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
    • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
    • ¥15 opencv图像处理,需要四个处理结果图
    • ¥15 无线移动边缘计算系统中的系统模型
    • ¥15 深度学习中的画图问题