自制仿豆丁网站,发布后上传有问题,本机IIS测试也有问题,求解释...
这个是本地IIS测试时候的地址, 这个是本地IIS测试报的错误,这个是我网上域名测试的地址
这是网上测试时候报的错误
求高手解释下我该怎么做...
整体原理是上传的时候调用cmd,调用flashpaper将上传文件转换,并附加一大串随机数字保存,但是现在上传都上传不上去了啊,flashpaper 这个软件装在服务器主机上,的C:/do/文件夹下 --------------------编程问答-------------------- 为毛木有人鸟我... --------------------编程问答-------------------- 文件不要放在桌面,这是个习惯。
有些权限不一样。 --------------------编程问答--------------------
我的桌面只是测试下,真正的放在盘里的,问题是 我租用的服务器,路径是D:/wwwroot/qq871117148/wwwroot/ck580/ 我程序发布的文件全部塞在这里, --------------------编程问答-------------------- .txt的只读属性去掉。。 --------------------编程问答-------------------- 文件夹---右键---权限--选取 --------------------编程问答--------------------
我在本地测试,就是不用IIs的时候,测试是可以运行、上传、并且及时转换了,文件也存到租用的服务器里了,放在服务器里的数据库里也有这个信息记录...为什么IIS,什么的就不行? --------------------编程问答-------------------- 只是因为.txt的原因???? --------------------编程问答-------------------- 试试吧,不确定。。 --------------------编程问答--------------------
这个是什么意思..看不太明白啊,为了支持flashpaper 我换了XP系统 --------------------编程问答--------------------
不行啊,我把发布后的文件夹,的只读属性去掉了,那个文件夹下的所有文件夹也统统关掉了只读属性,还是报错的,相同的错 --------------------编程问答-------------------- 权限不够呢。。
我之前也做这个效果。
但我没使用flashpaper 这个软件
却使用了pdf2swf这个软件,也就是只能上传pdf文件。
其他文件转到pdf是很简单的。我是用 flashpaper 转为 pdf,然后上传这个pdf文件,调用pdf2swf转为 swf来显示 --------------------编程问答-------------------- 本来上传后,../wwwroot/ck580/uploads文件夹下是应该有一份我上传的文件,然后通过cmd命令,调用flashpaper把此文档转换成SWF格式,保存到../wwwroot/ck580/swf 文件夹内的,可现在上传报错,然后Uploads和swf两个文件夹里都没有这个文件,我猜可能是上传没成功,没保存进去,继而转换的时候找不到要转换的文件,才出这个提示,怎么办? --------------------编程问答-------------------- 租用的服务器 就 更不能那样做啦。
--------------------编程问答-------------------- 寒..我要删掉重新写么, --------------------编程问答-------------------- 服务商已经帮我安装好了flashpaper 了 --------------------编程问答-------------------- 确定是上传报错?贴出上传代码,是不是大小受限制? --------------------编程问答-------------------- 文件夹---右键---权限--选取
修改文件夹的权限 --------------------编程问答--------------------
public partial class Up : System.Web.UI.Page
{
Document d = new Document();
User u = new User();
protected void Page_Load(object sender, EventArgs e)
{
u = (User)Session["LoginUser"];
if (u == null)
{
JScript.AlertAndRedirect("请登录后操作", "Login.aspx");
}
}
protected void UploadButton_Click(object sender, EventArgs e)
{
try
{
int.Parse(this.TextBox2.Text);
string saveDir = @"\Uploads\";
string[] cc = FileUpload1.FileName.Split('.');
int len = FileUpload1.FileName.Split('.').Length - 1;
if (!FileUpload1.HasFile)
{
Response.Write("<script>alert('请选择文档或截图上传.');</script>");
}
else
{
if (cc[len] != "txt" && cc[len] != "doc" && cc[len] != "ppt" && cc[len] != "xls" && cc[len] != "jpg" && cc[len] != "pdf" && cc[len] != "rtf")
{
Response.Write("<script> alert('只支持txt/doc/ppt等格式.'); window.location.href = 'Up.aspx?TypeId=1';</script>");
return;
}
else
{
if (FileUpload1.FileBytes.Length > 104857600)
{
Response.Write("<script> alert('大小不能超过10M.'); window.location.href = 'Up.aspx?TypeId=1';</script>");
return;
}
}
}
string appPath = Request.PhysicalApplicationPath;
if (FileUpload1.HasFile)
{
string SaveName = FileUpload1.FileName.Substring(0, FileUpload1.FileName.IndexOf(".")) + DateTime.Now.ToFileTime();
d = new Document();
string trueName = Server.HtmlEncode(SaveName + FileUpload1.FileName.Substring(FileUpload1.FileName.IndexOf(".")));
string savePath = saveDir + trueName;
FileUpload1.SaveAs(appPath + savePath);
d.DAbout = this.TextBox1.Text;
d.DCount = int.Parse(this.TextBox2.Text);
d.DName = FileUpload1.FileName;
d.DUrl = "/web" + savePath;
d.DUid = u;
d.DTime = DateTime.Now;
d.DType = int.Parse(DropDownList1.SelectedValue);
DocumentManager.addDocument(d);
UploadStatusLabel.Text = "上传成功了";
try
{
Process p = new Process();
p.StartInfo.FileName = "cmd";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardInput = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
p.Start();
string strOutput = null;
string s = @"C:\do\FlashPaper\FlashPrinter.exe " + Server.MapPath("Uploads/" + trueName) + " -o " + Server.MapPath("swf/" + SaveName + ".swf");
p.StandardInput.WriteLine(s);
p.StandardInput.WriteLine("exit");
strOutput = p.StandardOutput.ReadToEnd();
Console.WriteLine(strOutput);
p.WaitForExit();
p.Close();
lblMessage.Text = "ok";
}
catch (Exception ex)
{
lblMessage.Text = ex.ToString();
}
}
else
{
UploadStatusLabel.Text = "上传失败了";
}
}
catch(Exception ex)
{
JScript.Alert(ex.Message);
// JScript.Alert("文档积分设置错误");
return;
}
}
}
大小应该无关,我测试的文件只有几个字,经过我自己测试最大可以支持4M上传, 文件夹权限怎么修改,不是右键属性吗? --------------------编程问答-------------------- 常规 页面里 没法设置,点掉只读后,一确认,它又恢复只读了 --------------------编程问答--------------------
感谢啊...IIS测试可以上传了,但是在www.ck580.com 这个上面还是不行,改的是 Everyone 那个用户的权限,本来也是随便点上的,没想到IIS就好了 --------------------编程问答-------------------- 那现在是什么问题呢?
是不是能上传呢?
上传到网站目录 只需要 iis 权限就可以啦。 --------------------编程问答-------------------- 权限。
还要检查相关组件
http://www.htm2pdf.co.uk/
iTextSharp
下载
http://itextsharp.sourceforge.net/
参考
http://www.developerfusion.com/code/5682/create-pdf-files-on-fly-in-c/
http://csharp-source.net/open-source/pdf-libraries/itextsharp
http://topic.csdn.net/u/20090106/15/d18898ee-b232-4ee1-9469-5568072d8403.html --------------------编程问答-------------------- 权限。
--------------------编程问答--------------------
这样的话,不就是说我要上传的时候先转换成PDf再转换成SWF???不是多此一举么???flashpaper可以直接把文件转换成SWF的啊 --------------------编程问答-------------------- 求解 --------------------编程问答--------------------
上传可以,但是无法自动转换成SWF文件保存
--------------------编程问答-------------------- 无法自动转换成SWF文件
这个是要启动一个进程来做的,应该再贴出那段代码,网上有很多,也很简单的,你在本地确定可以?
补充:.NET技术 , ASP.NET