我在项目中使用了blueimp jquery文件上传插件,它在localhost上工作正常,但在线服务器上是反向的,每次我尝试上传时,进度条将从0%移动到100%,然后它会等待一段时间然后我收到此错误文件上传中止而不会在上传和我的控制台中点击中止按钮以及无法播放媒体。请求格式的解码器:image / jpeg 每次我在localhost和在线服务器上选择任何格式的图像文件(PNG,GIF,JPG ...)时,请问我该怎么解决这个问题?
答案 0 :(得分:0)
该插件正在使用localhost而不在在线服务器上工作的原因是不足 Uploadhandler.php 将任何上传的文件写入 blueimp jquery文件上传上传目录 server / php / files 所有你需要做的就是:
N:B 此解决方案不仅适用于 blueimp jquery文件上传,它还可以帮助解决任何与使用任何其他上传处理程序或插件类似的上传问题
如果您具有对服务器的SSH访问权限
运行此linux命令
sudo chown www-data:www-data /var/www/html/uploads
sudo chmod 755 /var/www/html/uploads
并查看与Apache服务器对应的最左侧列。这是运行Apache的用户,也是继承PHP的用户 假设上传目录相对于主目录上传,请在另一行之后运行以下命令
#include<iostream>
#include<cmath>
#include<complex>
#include<fftw3.h>
using namespace std;
int main()
{
int i,ir,nX;
nX = 16;
int nX3, nX2; //padded array dimension = nX3
nX3 = 3*nX;
nX2=2*nX;
double Nd = (double)nX3;
int id;
double pi = M_PI;
std::complex<double> *in, *out;
in = (complex<double>*)malloc(nX3*sizeof(complex<double>));
if(in==NULL) { cout<<"inalloc error\n"<<endl;}
out = (complex<double>*)malloc(nX3*sizeof(complex<double>));
if(out==NULL) { cout<<"outalloc error\n"<<endl;}
fftw_complex *bt;
bt = (fftw_complex*)fftw_malloc(sizeof(fftw_complex)*nX3);
fftw_plan p, q;
p = fftw_plan_dft_1d(nX3, reinterpret_cast<fftw_complex*>(in), bt, FFTW_FORWARD,FFTW_MEASURE);
q = fftw_plan_dft_1d(nX3, bt, reinterpret_cast<fftw_complex*>(out), FFTW_BACKWARD,FFTW_MEASURE);
for(i=0;i<nX3;i++)
{
in[i] = {0.0,0.0}; //initialising padded input array
}
for(i=nX;i<nX2;i++)
{
double id = (double)(i-nX)*pi/nX;
//sinusoidal input in the central square of the padded array (3 squares)
//varies in 'i' direction
in[i] = complex<double>(sin(id),0.0);
//cout<<"i\t"<<i-nX<<"\t"<<in[i]<<endl;
}
fftw_execute(p); //fourier transform
double kx;
int x1;
kx = 2.0*pi/(double)nX3;
double kx1;
for(i=0;i<nX;i++)
{
double btr(0.0), btc(0.0); //temporary variables
id=i+nX;
if(id<nX3/2) //1/2 filter
{
x1 = id;
}
else if(id==nX3/2)
{
x1 = 0;
}
else
{
x1 = id-nX3;
}
kx1=kx*(double)x1;
//complex first derivative array 'bt[id]'
btr = -1.0*kx1*bt[id][1]; //real part
btc = kx1*bt[id][0]; //complex part
bt[id][0] = btr;
bt[id][1] = btc;
}
fftw_execute(q); //inverse fourier transform
for(i=0;i<nX;i++)
{
//input sample varies only in the i direction, hence out[i+nX] should be identical for all 'y' and 'z' points inside the central cube at a specific value of 'i'
double id = (double)i*pi/nX;
double c = cos(id); //analytical value of first derivative for comparison with 'out[i+NX]'
cout<<"i\t"<<i<<"\t"<<c<<"\t"<<real(out[i+nX])/Nd<<endl;
//analytical value 'c' compared with fftw3 result, 'out'
//normalising 'out[i+nX]' by dividing it by volume of padded array dimension nX3
}
free(bt);
free(in);
free(out);
fftw_destroy_plan(p);
fftw_destroy_plan(q);
}