Markitup图片上传php源码相当于asp.net
我需要此源代码块的 ASP.NET 等效项。
/* The following is a very basic PHP script to handle the upload. One might also
* resize the image (send back the *new* size!) or save some image info to a
* database. Remember that you can modify the widget to include any data you'd like
* submitted along with the uploaded image.
*/
$upload_dir = '/var/www/vhosts/test/htdocs/uploads/';
$upload_path = $upload_dir . basename($_FILES['inline_upload_file']['name']);
$response = array();
if (move_uploaded_file($_FILES['inline_upload_file']['tmp_name'], $upload_path))
{
$info = getImageSize($upload_path);
$response['status'] = 'success';
$response['width'] = $info[0];
$response['height'] = $info[1];
$response['src'] = 'http://'
. $_SERVER['HTTP_HOST']
. substr(realpath($upload_path), strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
}
else
{
$response['status'] = 'error';
$response['msg'] = $_FILES['inline_upload_file']['error'];
}
echo json_encode($response);
I need asp.net equivalent of this source code block.
/* The following is a very basic PHP script to handle the upload. One might also
* resize the image (send back the *new* size!) or save some image info to a
* database. Remember that you can modify the widget to include any data you'd like
* submitted along with the uploaded image.
*/
$upload_dir = '/var/www/vhosts/test/htdocs/uploads/';
$upload_path = $upload_dir . basename($_FILES['inline_upload_file']['name']);
$response = array();
if (move_uploaded_file($_FILES['inline_upload_file']['tmp_name'], $upload_path))
{
$info = getImageSize($upload_path);
$response['status'] = 'success';
$response['width'] = $info[0];
$response['height'] = $info[1];
$response['src'] = 'http://'
. $_SERVER['HTTP_HOST']
. substr(realpath($upload_path), strlen(realpath($_SERVER['DOCUMENT_ROOT'])));
}
else
{
$response['status'] = 'error';
$response['msg'] = $_FILES['inline_upload_file']['error'];
}
echo json_encode($response);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无论如何,我只是在 google 上搜索了 php 函数并将其编写在 asp.net 中,并想在此处添加。对于任何只想为 markitup 添加图像上传插件并将其应用到 asp.net 的人来说,这可能会有所帮助
Anyway i just googled about php functions and wrote it in asp.net and wanted to add here. It could be helpful for anyone who just want to add image upload plugin for markitup and apply it in asp.net